Dumb Stupid Question About List and String
contact at xavierho.com
Wed Sep 1 17:05:12 CEST 2010
On 2 September 2010 00:47, Alban Nona <python.koda at gmail.com> wrote:
> So I figure out this night how to create automatically varibales via
> vars(), the script seems to work, exept that where it should give me a list
> like :
> [ELM004_DIF,ELM004_SPC,ELM004_RFL,ELM004_SSS, ELM004_REFR, ELM004_ALB,
> etc...] it gave me just one entry in my list, and the last one [ELM004_WPP]
> Any Ideas why that please ?
1) Avoid overwriting global functions like list as a variable name. If you
do that, you won't be able to use list() later in your code, and nor can
anyone else who imports your code.
2) I'm a bit iffy about automatic variable generations. Why not just use a
dictionary? What do others on comp.lang.python think?
3) I'm getting an error from your code, and it doesn't match with what you
seem to get:
Traceback (most recent call last):
File "Test.py", line 33, in <module>
NameError: name 'ELM001' is not defined
Did you get any compiler errors? I'm using Python 2.7
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list