字符串替换

f1=open("hello.txt","r")
f2=open("hello2.txt","w")
for s in f1.readlines():
    f2.write(s.replace("hello","hi"))
f1.close()
f2.close() 

 

posted @ 2010-01-23 23:41  HeartLight  阅读(224)  评论(0编辑  收藏  举报