Problem of function calls from map()

Dasn dasn at bluebottle.com
Mon Aug 21 09:50:11 EDT 2006


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() ? 

Thanks.




More information about the Python-list mailing list