convert string containing list to list (or tuple) type

Duncan Booth duncan.booth at invalid.invalid
Fri May 30 10:02:31 EDT 2008


"Poppy" <znfmail-pythonlang at yahoo.com> wrote:

> a = ',P,'
> b = ',I,G,AQ,ET,K,BF,'
> c = ',DZ,'
> 
> for ea in (a,b,c):
>     print lst_codes(ea.strip(","))
> 

Why not just use:

 ea.strip(',').split(',')

?

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list