The inverse of .join

Neil Cerutti neilc at norwich.edu
Fri Jun 18 11:45:36 EDT 2010


On 2010-06-18, Jon Clements <joncle at googlemail.com> wrote:
>> I just wondered if something smoother was available.
>
> In terms of behaviour and 'safety', I'd go for:
>
>>>> rec = { 'code1': '1,2,3', 'code2': '' }
>>>> next(csv.reader([rec['code1']]))
> ['1', '2', '3']
>>>> next(csv.reader([rec['code2']]))
> []

Slick!

-- 
Neil Cerutti



More information about the Python-list mailing list