I have to split a string into list. The input is as follows:
data = '''00402,
"0042 01,5",5
0042 02,3
"0042 02,5",1
"0042 05,5",4
"0042 05,5X05,5",7'''
The expected output is as follows:
['00402'],['0042 01,5', '5'],['0042 02', '3'],['0042 02,5', '1'],['0042 05,5', '4'],['0042 05,5X05,5', '7']
What I have tried to do so far is here:
temp_lines = filter(lambda x: x != '', data.split('\n'))
lines = []
for line in temp_lines:
lines.append(re.split(';|,|\*|\t', line.replace("\r", "")))
print lines
This has not produced the required output. Please help with this.