On 2 September 2010 00:47, Alban Nona <python.k...@gmail.com> wrote: > Hello, > > 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 ? > > http://pastebin.com/7CDbVgdD
Some comments: 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: # output ELM004_DIF ELM004_SPC ELM004_RFL ELM004_SSS ELM004_REFR ELM004_ALB ELM004_AMB ELM004_NRM ELM004_MVE ELM004_DPF ELM004_SDW ELM004_MAT ELM004_WPP Traceback (most recent call last): File "Test.py", line 33, in <module> print ELM001 NameError: name 'ELM001' is not defined Did you get any compiler errors? I'm using Python 2.7 Cheers, Xav
-- http://mail.python.org/mailman/listinfo/python-list