En Sat, 12 May 2007 20:13:48 -0300, Alex Martelli <[EMAIL PROTECTED]> escribió:
> Cesar G. Miguel <[EMAIL PROTECTED]> wrote: >> ------------------- >> L = [] >> file = ['5,1378,1,9', '2,1,4,5'] >> str='' >> for item in file: >> L.append([float(n) for n in item.split(',')]) > > The assignment to str is useless (in fact potentially damaging because > you're hiding a built-in name). > > L = [float(n) for item in file for n in item.split(',')] > > is what I'd call Pythonic, personally (yes, the two for clauses need to > be in this order, that of their nesting). But that's not the same as requested - you get a plain list, and the original was a list of lists: L = [[float(n) for n in item.split(',')] for item in file] And thanks for my "new English word of the day": supererogatory :) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list