I think you will have to iterate through the input file line by line. Something like for line in a: outp.write(line) If you want to write the contents of your x in range iteration: for x in range(1, 11): s = repr(x).rjust(2)+', '+ repr(x*x).rjust(3)+',' outp.write(s) Oeyvind 2007/11/18, Super Pija : > hello, > i didn't get any useful answer to the next question in any > programming/python forum. thanks a lot for any help. > Here's the question: > The next code creates a new file, and i can not find the way to write > *in that new file* the list below (*). How to do it? > > def Newtext (n): > outp =3D open("newfile.txt","w") > a =3D "new file" > outp.write(a) > outp.close() > > (*) > >>> for x in range(1, 11): > ... print repr(x).rjust(2), repr(x*x).rjust(3), > ... # Note trailing comma on previous line > ... print repr(x*x*x).rjust(4) > ... > 1 1 1 > 2 4 8 > 3 9 27 > 4 16 64 > 5 25 125 > 6 36 216 > 7 49 343 > 8 64 512 > 9 81 729 > 10 100 1000 > > > > > ____________________________________________________________________________________ > Be a better pen pal. > Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/ > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" >