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
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
Сергій 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
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
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
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
Сергій 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
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:
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
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
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
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
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
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
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.
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
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.
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
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
19 matches
Mail list logo