If you need read files like Example file_1 and file_2 you could use csv
reader, look this code and think how you could use it:

import csv

f1 = csv.reader(open('file1', newline=''),delimiter=' ')
for a, b, c in f1:
   print('%s %s %s' % (a, b, c))

2011/3/29 Peter Otten <[email protected]>

> Mateusz K wrote:
>
> > I have many text files, where data is delimited by space.
> > Each file contain three colums: coordinate x, coordinate y and value for
> > this location.
> >
> >      I would like to join this data to get one big file which will
> > contain columns:
> > coordinate x, coordinate y, value1,value2,..., value_n and save it to
> > another text file.
> >
> > I wrote script, but there's some stupid error (like "\n" character
> > although I have added .rstrip() command).
> >
> > Coul You tell me what is most convenient way to join this data
> > (maybe by using csv module?)?
>
> Please show us the code that you have. This proves that you've put some
> effort into the matter and allows us to focus on the missing parts.
>
> _______________________________________________
> Tutor maillist  -  [email protected]
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to