I have a list of elements. for each element I want to split into 3 numbers separated by ‘,’ and print them.
My code is not doing what I want. :S
l = ['14,23,63\n','41,20,76\n','65,23,42\n']
for element in l:
element.split(',')
print element[0],element[1],element[2] #outcome should be e.g. 14,23,63
str.splitreturns a new list.Also you probably want to trim as well (
element.strip().split(',')).