I am trying to map the str.split function to an array of string. namely, I would like to split all the strings in a string array that follow the same format. Any id
str.split
Use map in conjunction with a function. A neat way is to use a lambda function:
>>> a=['2011-12-22 46:31:11','2011-12-20 20:19:17', '2011-12-20 01:09:21'] >>> map(lambda s: s.split(), a) [['2011-12-22', '46:31:11'], ['2011-12-20', '20:19:17'], ['2011-12-20', '01:09:21']]