newbie question(file-delete trailing comma)

Mohammad Tayseer m_tayseer82 at yahoo.com
Mon Feb 26 05:43:23 EST 2007


in_file = open('in.txt')
out_file = open('out.txt', 'w')
for line in in_file:
    print >> out_file, line.strip(',')

kavitha thankaian <kavithapython at yahoo.co.in> wrote: hi,
   
  i have a file which has the contents as follows:
   
  a,b,c,d,
  a1,b1,c1,d1,
  a2,b2,c2,d2,
   
  i would like to delete all the trailing commas,,
   
  if someoneknows pls help me,,
   
  kavitha
         

---------------------------------
  Here’s a new way to find what you're looking for - Yahoo! Answers -- 
http://mail.python.org/mailman/listinfo/python-list

 
---------------------------------
Now that's room service! Choose from over 150,000 hotels 
in 45,000 destinations on Yahoo! Travel to find your fit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070226/e0ca1163/attachment.html>


More information about the Python-list mailing list