Friday 15 February 2013

splitting whole list of strings in python -



splitting whole list of strings in python -

i have list of python strings in list.

i want phone call split method @ each string in list , store results in list without using loops because list long.

edit1 here 1 example

input = ["a,the,an","b,b,c","people,downvoting,it,must,think,first"] output [["a","the","an"],["b","b","c"],["people","downvoting","it","must","think","first"]]

the delimiter used splitting ","

any trick this?

[a.split(',') in list] sample: ['a,c,b','1,2,3'] result: [['a','c','b'],['1','2','3']]

if wanted in 1 list, seek (not sure of how efficient is)

output = sum([a.split(',') in list],[]) sample: ['a,c,b','1,2,3'] result: ['a','c','b','1','2','3']

python string list

No comments:

Post a Comment