newbie question(file-delete trailing comma)

kavitha thankaian kavithapython at yahoo.co.in
Tue Feb 27 06:13:20 EST 2007


i get an error when i try to delete in file and rename it as out file,,the error says
  "permission denied".
   
  actually i need something like following:
   
  in_file = open('in.txt','w')
for line in in_file:
    line.strip().strip(',')
   
  but when i run the above code,i get an error"bad file descriptor"
   
  thanks,,
   
  kavitha
   
  

Mohammad Tayseer <m_tayseer82 at yahoo.com> wrote:
  kavitha thankaian <kavithapython at yahoo.co.in> wrote:
> and i need the output also in the same input.txt

just add

import os
os.remove('in.txt')
os.rename('out.txt', 'in.txt')
    
---------------------------------
  Don't be flakey. Get Yahoo! Mail for Mobile and 
always stay connected to friends.-- 
http://mail.python.org/mailman/listinfo/python-list

 				
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070227/c742eb3f/attachment.html>


More information about the Python-list mailing list