Dasn wrote: > > Hi, there. > > 'lines' is a large list of strings each of which is seperated by '\t' >>>> lines = ['bla\tbla\tblah', 'bh\tb\tb', ... ] > > I wanna split each string into a list. For speed, using map() instead > of 'for' loop. 'map(str.split, lines)' works fine , but... > when I was trying: > >>>> l = map(str.split('\t'), lines) > > I got "TypeError: 'list' object is not callable". > > To avoid function call overhead, I am not willing to use lambda function > either. So how to put '\t' argument to split() in map() ?
You can't. Use a lambda or list-comprehension. map(lambda l: l.split("\t"), lines) [l.split("\t") for l in lines] Diez -- http://mail.python.org/mailman/listinfo/python-list