Dumb Stupid Question About List and String

Alban Nona python.koda at gmail.com
Wed Sep 1 12:49:57 EDT 2010


Hello Xavier,

Thank you :)

Well what Iam trying to generate is that kind of result:

listn1=['ELM001_DIF', 'ELM001_SPC', 'ELM001_RFL', 'ELM001_SSS',
'ELM001_REFR', 'ELM001_ALB', 'ELM001_AMB', 'ELM001_NRM', 'ELM001_MVE',
'ELM001_DPF', 'ELM001_SDW', 'ELM001_MAT', 'ELM001_WPP']

listn2 = ['ELM002_DIF', 'ELM002_SPC', 'ELM002_RFL', 'ELM002_SSS',
'ELM002_REFR', 'ELM002_ALB', 'ELM002_AMB', 'ELM002_NRM', 'ELM002_MVE',
'ELM002_DPF', 'ELM002_SDW', 'ELM002_MAT', 'ELM002_WPP']

etc...

The thing is, the first list will be generated automatically. (so there will
be unknow versions of ELM00x....)
that why Im trying to figure out how to genere variable and list in an
automatic way.

Can you tell me if its not clear please ? :P
my english still need improvement when Im trying to explain scripting
things.

2010/9/1 Xavier Ho <contact at xavierho.com>

> On 2 September 2010 01:11, Alban Nona <python.koda at gmail.com> wrote:
>
>> Hello,
>>
>> seems to have the same error with python.
>> In fact I was coding within nuke, a 2d compositing software (not the best)
>> unfortunately, I dont see how I can use dictionnary to do what I would
>> like to do.
>>
>
> Hello Alban,
>
> The reason it's printing only the ELM004 elements is because the variable,
> first, is 'ELM004' when your code goes to line 29.
>
> I noticed you're using variables created from the for loop out of its block
> as well. Personally I wouldn't recommend it as good practice. There are ways
> around it.
>
> Could you explain briefly what you want to achieve with this program?
> What's the desired sample output?
>
> Cheers,
> Xav
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100901/6d340ac1/attachment-0003.html>


More information about the Python-list mailing list