Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Create object for item in list

Thread Tools

Create object for item in list

Posts: n/a
I wonder how this can be accomplished:

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

[ "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)

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
List index method for complex list item types? Python 4 12-31-2005 03:44 AM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
Created object on stack and then returned this object to caller. Item deleted but still there?? opistobranchia C++ 1 08-14-2005 07:51 PM
Create object for item in list Helge Python 2 04-29-2004 08:43 PM
Change style of a single row of the item list of datagrid, based on a field value of current item... QUASAR ASP .Net Datagrid Control 6 01-17-2004 07:46 PM