Thanks Oscar figured it out...:)
On 11 April 2013 00:17, Oscar Benjamin <oscar.j.benja...@gmail.com> wrote: > 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 > -- -------------------------------------------------------------------------- *Sayan Chatterjee* Dept. of Physics and Meteorology IIT Kharagpur Lal Bahadur Shastry Hall of Residence Room AB 205 Mob: +91 9874513565 blog: www.blissprofound.blogspot.com Volunteer , Padakshep www.padakshep.org
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor