Use '\n'.join(handle[1:])

It will create a string from your list with newline as separator.

 Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/





________________________________
From: Bala subramanian <[email protected]>
To: Alan Gauld <[email protected]>
Sent: Thursday, 26 March, 2009 6:11:59 PM
Subject: Re: [Tutor] printing files

yes you are right,
When i use the following

print>>out, handle[1:]

In the out file, it saves the lines as a list rather than as a string. How to 
avoid this. 

Bala


On Thu, Mar 26, 2009 at 7:05 PM, Alan Gauld <[email protected]> wrote:


"Bala subramanian" <[email protected]> wrote


for files in flist:
 handle=open(flist).readlines()
 print>>out, handle  


 print>>out, handle[1:]

Should do it? You might need to handle line endings though...  
Alan G.


_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to