Create object for item in list

Helge helge at hefre.com
Thu Apr 29 15:09:51 EDT 2004


I wonder how this can be accomplished:

I've got a list, containing several strings. The strings look like
this:

[ "Name1/N1/N2/N3" , "Name2/N1/N2/N3" , "..." ]

I would like to create one object for each item in the list, and the
name of the object should be "str(item.split("/")[0])".

I've tried this, but it won't work:

for item in list:
    str(item.split("/")[0]) = class(item)

...



More information about the Python-list mailing list