Re: [Tutor] using -i flag with '''if __name__ == "__main__":'''

2005-05-20 Thread Alan G
> > I think this approach to debugging won't scale well and you are just > > seeing the tip of the iceberg [and more helpful stuff, snipped.] > > Thanks to you both. I think I may need to step up my "development > environment" beyond emacs and a command line. I don't see why. The very biggest

[Tutor] "classmethods"

2005-05-20 Thread Christian Meesters
Hi I've asked a similar question before, but still I have to admit that I didn't find a solution with this particular problem here: Imaging you have a class with a certain __init__ function like: class MyClass: def __init__(parameter1, parameter2=default,*args,**kwargs):

[Tutor] Comparing a string

2005-05-20 Thread Jonas Melian
I'm tryin compare a string with a value with style of pattern-matching. string = 'i686' if string == glob.glob(i?86): This is fails because glob() is for listing files in a directory that match a Unix ls-pattern how make it? Thanks! ___ Tutor maillis

Re: [Tutor] using -i flag with '''if __name__ == "__main__":'''

2005-05-20 Thread Kent Johnson
Alan G wrote: >>>I think this approach to debugging won't scale well and you are > > just > >>>seeing the tip of the iceberg [and more helpful stuff, > > snipped.] > >>Thanks to you both. I think I may need to step up my "development >>environment" beyond emacs and a command line. > > >

Re: [Tutor] "classmethods"

2005-05-20 Thread Kent Johnson
Christian Meesters wrote: > Hi > > I've asked a similar question before, but still I have to admit that I > didn't find a solution with this particular problem here: > > Imaging you have a class with a certain __init__ function like: > class MyClass: > def __init__(parameter1, parameter2=d

Re: [Tutor] Comparing a string

2005-05-20 Thread jfouhy
Quoting Jonas Melian <[EMAIL PROTECTED]>: > I'm tryin compare a string with a value with style of pattern-matching. > > string = 'i686' > > if string == glob.glob(i?86): This is a task for regular expressions! Have a look at the re module. (and feel free to ask for more help if you're having

[Tutor] RPG game.

2005-05-20 Thread . ,
I'm trying to make an RPG game which is only consisted of texts. But, it doesn't work! thanks. --- import random print \ """Warrior - damage: 10~60

Re: [Tutor] diving into py question

2005-05-20 Thread Chelan Farsight
It worked! Thanks so much for the help. I spose its just difficult to read some of this. Not sure why that is the case for me, but I will be paying much closer attention from now on. Again thank you. Chelan On 5/19/05, Max Noel <[EMAIL PROTECTED]> wrote: > > On May 19, 2005, at 22:46, Chelan Fa

[Tutor] printing documents

2005-05-20 Thread Jeff Peery
hello,   I am writing a program to store name/contact/business transaction information. I would like the ability to print out a form for each client with all this stored information.  Can somone point me in the write direction for printing documents. How do I go about setting up a printable page w

Re: [Tutor] Disable menubar

2005-05-20 Thread Alberto Troiano
Thank you very much for your help Now it's all clear Thanks again and best regards Alberto >From: "Michael P. Reilly" <[EMAIL PROTECTED]> >Reply-To: "Michael P. Reilly" <[EMAIL PROTECTED]> >To: Alberto Troiano <[EMAIL PROTECTED]> >Subject: Re: [Tutor] Disable menubar >Date: Thu, 19 May 2005 19:

Re: [Tutor] RPG game.

2005-05-20 Thread Kooser, Ara S
Could you post the error message? Ara Fatti non foste per viver come bruti, ma per seguir virtute e canoscenza - Dante Alighieri You were not made to live like brutes, but to pursue virtue and knowledge -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf

Re: [Tutor] RPG game.

2005-05-20 Thread Alberto Troiano
Hey You must set dmg to a value before using it The error is that the variable dmg hasn't been asigned yet >wp = raw_input("\n\nSelect between warrior and Archer ") > >mob = 300 >hit = 0 >hp = 100 >run = "" > >while True: > while (mob > 0): > hit += 1 > mob = mob - dmg#HE

Re: [Tutor] RPG game.

2005-05-20 Thread . ,
I can't see the error message because the program ends fast. >From: "Kooser, Ara S" <[EMAIL PROTECTED]> >To: ". ," <[EMAIL PROTECTED]>,tutor@python.org >Subject: RE: [Tutor] RPG game. >Date: Fri, 20 May 2005 08:32:42 -0600 > >Could you post the error message? > >Ara > > > > > > >Fatti non foste p

Re: [Tutor] RPG game.

2005-05-20 Thread . ,
It works fine but, at the end of the program total damage has to be shown. Only single damage is shown. How can i change it? --- import random print \ """

Re: [Tutor] dictionary values in strings

2005-05-20 Thread William O'Higgins
On Thu, May 19, 2005 at 09:47:50PM +0100, Max Noel wrote: > >On May 19, 2005, at 20:49, William O'Higgins wrote: > >>I am trying to discover the syntax for call on a dictionary of >>lists by >>key and index. >> >>The data structure looks like this: >> >>dol = {'key1':['li1','li2','li3'],'key2':['

[Tutor] creating files on open()

2005-05-20 Thread William O'Higgins
When I am open()-ing a file, I sort of expect that if the file doesn't exist that it would be created, but it doesn't, it whines about it instead. So, how do I create a file with Python? I've looked all over, but I'm obviously missing something. Thanks. -- yours, William signature.asc Desc

Re: [Tutor] creating files on open()

2005-05-20 Thread Kent Johnson
William O'Higgins wrote: > When I am open()-ing a file, I sort of expect that if the file doesn't > exist that it would be created, but it doesn't, it whines about it > instead. So, how do I create a file with Python? I've looked all over, > but I'm obviously missing something. Thanks. Opening

Re: [Tutor] creating files on open()

2005-05-20 Thread William O'Higgins
On Fri, May 20, 2005 at 01:48:19PM -0500, Kristian Zoerhoff wrote: >On 5/20/05, William O'Higgins <[EMAIL PROTECTED]> wrote: >> When I am open()-ing a file, I sort of expect that if the file doesn't >> exist that it would be created, but it doesn't, it whines about it >> instead. So, how do I crea

Re: [Tutor] creating files on open()

2005-05-20 Thread Kristian Zoerhoff
On 5/20/05, William O'Higgins <[EMAIL PROTECTED]> wrote: > > Fascinating. I was opening the file read-write (r+) and it didn't work. > Are there only the few file-access methods (read (r), write (w), append > (a) and read-write (r+))? Sometimes I like to prepend or to clobber or > to address in b

[Tutor] Crossfire problem

2005-05-20 Thread Alberto Troiano
Hey everyone I have a very big problem with two versions of Python (2.2.2 and 2.3.4) over Linux Red Hat 9.0 I'll try to be as explicit as I can In the version 2.2.2 I have the module MySQLdb running but not the datetime module. In the version 2.3.4 I have the module datetime running but not th

[Tutor] Need some advice.

2005-05-20 Thread . ,
It works fine but, at the end of the program total damage has to be shown. Only single damage is shown. How can i change it? --- import random print \ """

[Tutor] Is anyone still working on the Python Riddles? #12

2005-05-20 Thread D. Hartley
Hello everyone! I know the thread has died down to nothing, but I was wondering, is anyone still working on the python challenges? I managed to get to #12 (!!) and feel like I'm learning a lot, especially about PIL. I'm stuck on this one now, tho, and it seems like everyone in the forum got the b

Re: [Tutor] Crossfire problem

2005-05-20 Thread Kent Johnson
Alberto Troiano wrote: > These are the commands I need from datetime module. Is there another way to > get this info > > hoy=datetime.datetime.now() # Today's date and time as a tuple > dia=days[hoy.isoweekday()] # Today's dayweek as integer from 0 to 6 > grupo=datetime.datetime.today().strft

Re: [Tutor] "classmethods"

2005-05-20 Thread Alan G
> Now, how do I create an instance of MyClass when calling: x = MyClass.fromfile(path) ? Why not use an instance method and just do: x = MyClass().fromFile(path) provided fromPath() returns self there should be no problem. That is, MyClass looks like: class MyClass: def __init__(self):

Re: [Tutor] Comparing a string

2005-05-20 Thread Alan G
> I'm tryin compare a string with a value with style of pattern-matching. > > string = 'i686' > > if string == glob.glob(i?86): Use regular expressions and turn it around: import re s = 'i686' ex = re.compile('i?86') if ex.match(s): print 'they match!' Is that what you mean? Alan G. _

Re: [Tutor] printing documents

2005-05-20 Thread Alan G
> I am writing a program to store name/contact/business transaction > information. I would like the ability to print out a form for each > client with all this stored information. Can somone point me in the > write direction for printing documents. I usually just create html files. PDF would work

Re: [Tutor] creating files on open()

2005-05-20 Thread Alan G
> to address in binary mode - are these things possible, or do I have to > seek() to prepend and delete to clobber? Thanks. Using seek() will not prepend it will overwrite! To prepend you will have to write out your preamble then append the existing data to that. There is no random access mechan

[Tutor] Python in HTML

2005-05-20 Thread Orri Ganel
Hello all, I've been trying to use javascript for coding something on a webpage, and I've just about given up on understanding the intricacies of why a given script will work now and not in 5 minutes, and why any bit of code longer than 5 lines doesn't behave as documented. Therefore, I thoug

Re: [Tutor] Python in HTML

2005-05-20 Thread Liam Clarke
Hi Orri, I've pondered that too, and you're out of luck, I think. There is a _javascript_/XUL/XBL/XPCOM interface in Mozilla browsers, it's quite low level and messy, and there's an XPCOM/Python interface also, but it's quite beta and hard to use. You can use Python like PHP or Perl, but it does

Re: [Tutor] "classmethods"

2005-05-20 Thread Christian Meesters
Hi Thanks Kent and Alan for your input. Kent's example is working like a charm. It's just that I didn't find the time to give any feedback until now. Have a nice weekend! Christian ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailma