[Zope] string to list

Passin,Thomas B. (Tom) tpassin@mitretek.org
Tue, 17 Sep 2002 11:56:06 -0400


[ Bryan C. Andregg ]
>=20
> I have a list that is stored in a database. When I retrieve=20
> the list it's returned as a string. I.E., ['a', 'b'] is not=20
> iterable. Does anyone have a conventient way to turn the=20
> string back into a list or should I just do the store differently?
>=20

Look at my post form Sept. 3, and the related thread, titled

Re: [Zope] lists, not strings in database

This should be close enough to work with.  If you really get a string
"['a','b']", you can strip off the leading and trailing brackets and the
quotes and proceed as in the thread.  You could also convert to a list
of strings using eval() in an external method, but that would be
overkill, I think.

Cheers,

Tom P