Tuesday, 17 September 2013

python find and replace with return type

import re

def sam(file):
    return re.sub(":"," ", file)


f=open("/etc/passwd","r")
for i in f.readlines():
    s=sam(i)
    print s

No comments:

Post a Comment