On 10 April 2013 17:58, Sayan Chatterjee <sayanchatter...@gmail.com> wrote: > Thank Andre for your prompt answer. > > I'll figure out the plotting issue once the dat files are made. So it's the > primary concern. > For an example I am attaching a dat file herewith. The two columns here are > 2 numpy arrays.I want to add a third column, to be precise, I want to print > a parameter value on the third column of the file.
The file you attached is a space-delimited text file. If you want to add a third column with the value '1.0' on every row you can just do: with open('old.dat') as fin, open('new.dat', 'w') as fout: for line in fin: fout.write(line[:-1] + ' 1.0\n') Oscar _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor