Prev: Efficiency/style issues of import <module> vs. from <module> import <name>, ...
Next: Running a program from another program.
From: Neil Cerutti on 18 Jun 2010 11:45 On 2010-06-18, Jon Clements <joncle(a)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 |