Re: [Tutor] Python Programming Books

2006-07-15 Thread Matt Richardson
On 7/14/06, wesley chun [EMAIL PROTECTED] wrote: (LONG... you've been warned ;-) ) snip Heh, that was pretty long. I bought the first edition of Core Python and thought that it was well-written, but I didn't quite get it (stay with me, this gets better). It wasn't until after I had taken quite

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Сергій
In fact I want to create a list of variables from the list of strings Example: ['var1', 'var2', 'var3'] - list of strings And I need to create variables var1, var2, var3 named as strings in the list, and: var1 == 'var1' var2 == 'var2' var3 == 'var3' How to do this using only my list and for

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Luke Paireepinart
Сергій wrote: In fact I want to create a list of variables from the list of strings Example: ['var1', 'var2', 'var3'] - list of strings And I need to create variables var1, var2, var3 named as strings in the list, and: var1 == 'var1' var2 == 'var2' var3 == 'var3' How to do this

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Fabrizio Milo aka misto
Hi! I don't know why you want to do that but actually it is possibble. for i in xrange(1): ...exec( 'var_%s = var_%s' %(i,i), locals() ) var_100 'var_100' Regards. ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Hi, need help on zip commands for windows

2006-07-15 Thread Fabrizio Milo aka misto
Can somebody explain what I'm doing wrong? The problem should be in the string passed to os.system try to print the complete string that you are passing to os.system. then run a shell and paste the complete string on the shell, I am sure that the shell will complain about something. Fabrizio

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Kent Johnson
Fabrizio Milo aka misto wrote: Hi! I don't know why you want to do that but actually it is possibble. for i in xrange(1): ...exec( 'var_%s = var_%s' %(i,i), locals() ) var_100 'var_100' It is possible but it's unlikely that it is the best solution to

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Kent Johnson
Сергій wrote: In fact I want to create a list of variables from the list of strings Example: ['var1', 'var2', 'var3'] - list of strings And I need to create variables var1, var2, var3 named as strings in the list, and: var1 == 'var1' var2 == 'var2' var3 == 'var3' How to do this using

Re: [Tutor] Needing to create a program that will search my hard drive for certain folders

2006-07-15 Thread Kent Johnson
Bobby J. Howerton Jr. wrote: Hello, I am new to programming in Python, but I am very excited about the possibilities that it (Python) has. I maybe jumping the gun a little bit here, but this is what I would like to do:

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Alan Gauld
In fact I want to create a list of variables from the list of strings Example: ['var1', 'var2', 'var3'] - list of strings And I need to create variables var1, var2, var3 named as strings in the list, and: var1 == 'var1' var2 == 'var2' var3 == 'var3' How to do this using only my list

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Dave Kuhlman
On Fri, Jul 14, 2006 at 09:25:57PM -0400, Etienne Robillard wrote: --- ÁÕàÓöÙ [EMAIL PROTECTED] wrote: suppose I need to create 1000 000 variables var_1, var_2, var_100 how to do this using for? (something like for i in range(100): ___var_ How would you

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Michael P. Reilly
On 7/14/06, Сергій [EMAIL PROTECTED] wrote: supposeI need to create 1000 000 variables var_1, var_2, var_100 how to do this using for? (something like for i in range(100): ___var_ You should think about not creating variables like this, it is bad programming and continuing to use

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Сергій
But again, like others have suggested, you should rethink your problem and your solution before starting down your path. What are you really capturing? Rethink problem... I try to use sgmllib - get all info tagged in h1... h6 I'vecreated file lister.py: from sgmllib import SGMLParser class

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Сергій
And I don't like this BAD CODE1 and BAD CODE2 How to rewrite bad codes??? about BAD CODE2 -I've fount a good solution (or it seems to me to be good :) ): tags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] for i in tags:Show_step(i)for j in getattr(parser, i):print j

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Michael P. Reilly
Good. But one VERY important point to note is that that you are not working with variables here. You are working with members of a class instance. This is a very different beast. You could just use getattr(), setattr() and delattr() for these. But continuing... you might want to think about this

Re: [Tutor] [SOLVED] Basic QT query #2

2006-07-15 Thread Dave S
On Friday 14 July 2006 23:21, Dave S wrote: On Friday 14 July 2006 19:21, Dave S wrote: Hi all, I am trying to get to grips with QT, putting a friendly face on some of my apps :) Its early days and my first attempt but I expected the following to print 'hi it works' every second.

[Tutor] How do you implement a config file?

2006-07-15 Thread Tracy R Reed
I am writing a small python application that needs a few variables to be end user configurable. Right now I just have the variables right up front where the user can tweak them in the program code and a big commented line that says Nothing editable past this point. But I would like to be able to

Re: [Tutor] create 1000 000 variables

2006-07-15 Thread Danny Yoo
In fact I want to create a list of variables from the list of strings Example: ['var1', 'var2', 'var3'] - list of strings Ok, let's stop for the moment. Do you know about dictionaries yet? If not, we should point this out to you, because they solve the problem you describe.

Re: [Tutor] How do you implement a config file?

2006-07-15 Thread Danny Yoo
I am writing a small python application that needs a few variables to be end user configurable. Right now I just have the variables right up front where the user can tweak them in the program code and a big commented line that says Nothing editable past this point. But I would like to

[Tutor] error: (10054, 'Connection reset by peer')

2006-07-15 Thread Grady Henry
Here is a program that I wrote using one of the python.org's examples at 12.2.13 (first example listed): # Import smtplib for the actual sending functionimport smtplib # Import the email modules we'll needfrom email.MIMEText import MIMEText # Open a plain text file for reading. For this