Create object for item in list

Discussion in 'Python' started by Helge, Apr 29, 2004.

  1. Helge

    Helge Guest

    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)

    ....
     
    Helge, Apr 29, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ssoss

    Display Related Item or Add Item

    ssoss, Sep 17, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    507
    ssoss
    Sep 19, 2003
  2. Replies:
    2
    Views:
    638
  3. Helge

    Create object for item in list

    Helge, Apr 29, 2004, in forum: Python
    Replies:
    2
    Views:
    400
    Terry Reedy
    Apr 29, 2004
  4. jon wayne
    Replies:
    9
    Views:
    732
    Jim Langston
    Sep 22, 2005
  5. QUASAR
    Replies:
    6
    Views:
    448
    QUASAR
    Jan 17, 2004
Loading...

Share This Page