Sean Perry wrote:
> Ok, this may be slightly above tutor's level, but hey, never hurts to
> ask (-:
__import__ is dark magic; generally those who venture into that realm
would do well to read the C source for Python..
I'm guessing that '.' is not in your sys.path, so Python isn't finding
the rel
Shivayogi,
Sorry my last e-mail wasn't very helpful.
Better would have been:
>>> a=myClass()
>>> b=myClass()
>>> a.howmany()
>>> myClass.count=0
>>> del a
which will (hopefully) give you something like:
Exception exceptions.AssertionError: in > ignored
Assert is commonly used as a sanity
Try this:
>>>a=myClass()
>>>b=myClass()
>>>a.howmany()
>>>a.count=0
>>>del a
Does this help clear things up?
Todd Maynard
On Friday 23 December 2005 06:18, shivayogi kumbar wrote:
> class myClass:
> count = 0
> def __init__(self):
>
Scott,
Take a look at setuptools: http://peak.telecommunity.com/DevCenter/setuptools
It should handle everything you are looking for with ease. Turbogears
( http://turbogears.org )is a real world project that uses it.
So far it seems to be flexible and reliabe for me.
Good Luck,
--Todd Ma
>>> import sys
>>> import time
>>> myList=range(10)
>>> for x in myList:
... sys.stdout.write(str(x) + "\r")
... sys.stdout.flush()
... time.sleep(1)
The "\r" causes a return without a newline feed.
Flush forces the text to be output (instead of getting buffered)
Enjoy!
Todd Maynard
Ignoring the python stuff for the moment
In answer to Question 1., You want to use Public Key authentication...this
will let you log in without a password.Google for SSH Public Key
Authentication will give you several hits for the howto's
One pretty good one was
http://www.puddingonli
How about changing it into a math quiz program?
You have the program output random problems ("What is 14 * 3 ?")
And then you can output appropriate random insults, words of encouragement, or
praise as appropriate until the user gets the answer right. Just be careful
with division. You proba
Not sure exactly what you have going wrong without the code or the exact url
you are using.
Does something like:
import urllib
page =
urllib.urlopen("http://slashdot.org/article.pl?sid=05/08/08/043236&tid=126";).read()
print page
give you the correct results?
Is the problem specific to o
Let's see if I can get this right.as I am working on memory and not enough
sleep.
The 'r' means that using a raw string so the backslashes aren't escaped
out
The equivalent without using the 'r' would be: os.chdir('c:\\temp')
--Todd
On Monday 08 August 2005 03:07 am, Don Parris wrote:
Are you:
a.) Having trouble with the code and looking for help?
b.) Looking for suggestions on how to improve the code?
c.) Offering the code as a demo for Nathan et al.?
I was just doing stuff along the same lines and was having fun seeing the
different approaches to the same problem.
-
Remember this problem from yesterday?
Take a look at the line before the one you are getting the error on.
And count the ('s and the )'s.
--Todd
On Sunday 31 July 2005 07:38 pm, Nathan Pinno wrote:
> What the invalid syntax? Here is the error message:
> SyntaxError: invalid syntax
> File "D
Congratulations! So what are you going to try next?
--Todd
On Sunday 31 July 2005 06:27 pm, Nathan Pinno wrote:
> The Giant Calculator is perfect also!
> - Original Message -
> From: Nathan Pinno
> To: tutor@python.org
> Sent: Sunday, July 31, 2005 3:34 PM
> Subject: [Tutor] T
Have you worked through the diveintopython.org tutorial/book? Chapter 6
covers file handling. If/When you get stuck post your code/question and ask
for help.
--Todd
On Saturday 30 July 2005 11:49 pm, Nathan Pinno wrote:
> If anyone will help me learn file I/O, it would be appreciated. I went
You are almost there.
Do you undestand why you are getting the output that you are getting?
Pretend that you are the computer and walk through what happens when you enter
9 at the menu:
while cal_opt != 9:
menu()
cal_opt = cal() # This is where you entered '9' so cal_opt
Looks like you are making some pretty good progress.
The short answer to your question is that the menu & user input need to be
inside the while loop. That way cal_opt has a chance to change value before
it gets evaluated by the while loop again.
Another comment - the global cal_opt is conside
How does the user indicate that they are done with the program?
One solution is to ask at the end of each iteration if they want to repeat.
Psuedocode:
keep_going=True
while(keep_going)
Run your program stuff
keep_going = get_user_response("Do you want to run again?")
--Todd
On Saturd
I'd count the parenthesis on the prior line:
option = int(raw_input('Option (1,2,3,4,5,6,9): ')
while option != 9:
Also when you notice that you are copying and pasting the same line over and
over, it may be time to think about reorganizing the code a little bit (Once
you have it working)
17 matches
Mail list logo