There is table of data
1 2
1 3
33 34
10 22
11 23
25 26
27 28
.....
now I need to split data in the two columns and merge them in to a single list The code I have written below does the job for single digit numbers but not for two or three digit numbers.
myfile = open("karate.txt","r") #read and write to a file
for line in myfile.read(): # read data in the file
fields = ' '.join(line.split()) # split columns of table based on space
print fields
rows = map(int,fields) # converting tuple to integer
data.extend(rows)
The output of this code for the above data is
1
2
1
3
3
3
3
4
1
but I need the output as
1
2
1
3
33
34
11
23
25
26
27
28