On Fri, May 13, 2011 at 1:15 PM, noydb <jenn.du...@gmail.com> wrote:
> I want some code to take the items in a semi-colon-delimted string
> "list" and places each in a python list.  I came up with below.  In
> the name of learning how to do things properly, do you experts have a
> better way of doing it?

Strings have a split method, which splits the string into a list based
on a delimiter, like this:

>>> x = "red;blue;green;yellow"
>>> color_list = x.split(";")
>>> print color_list
['red', 'blue', 'green', 'yellow']

That's how I'd do it.

-- 
Jerry
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to