how to merge file lines having the same first word in python?
- by user1377135
I have written a program to merge lines in a file containing the same first word in python.
However I am unable to get the desired output.
Can anyone please suggest me the mistake in my program?
input
"file.txt"
line1: a b c
line2: a b1 c1
line3: d e f
line4: i j k
line5: i s t
line6: i m n
`
output
a b c a b1 c1
d e f
i j k i…