Monday, 16 September 2013

Strip extra space in a file using python

import re
f1=open("sam","r")
for i in f1.readlines():
    d=re.sub(' +',' ',i)
    e=d.split(" ")[3]
    if e > 0:
      print  i

No comments:

Post a Comment