RickMuller wrote: > One of my all-time favorite scripts is parseline, which is printed
here is another way to write that:
def parseline(line, format):
trans = {'x':lambda x:None,'s':str,'f':float,'d':int,'i':int}
return [ trans[f](w) for f,w in zip(format, line.split() ) ]
>>> parseline( 'A 1 22 3 6', 'sdxf')
['A', 1, None, 3.0]
I.
--
http://mail.python.org/mailman/listinfo/python-list
