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
t
> 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
> lik
> 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 be able to
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 seco
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 t
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
"
__
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've created file lister.py:
"from sgmllib import SGMLParser
On 7/14/06, Сергій <[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_
You should think about not creating variables like this, it is bad programming and continuing to use
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_
>
>
>
> 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
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:
> **
Сергій 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
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 i
> 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
_
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
http://mail.python.org/mailman/l
Сергій 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
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 "f
18 matches
Mail list logo