recipe-435904.py 文件源码

python
阅读 51 收藏 0 点赞 0 评论 0

项目:code 作者: ActiveState 项目源码 文件源码
def replacestrs(filename):
    "replace a certain type of string occurances in all files in a directory" 

    files = glob.glob(filename)
    #print 'files in files:', files
    stext = '-d0'
    rtext = '-r0'

    for line in fileinput.input(files,inplace=1):

        lineno = 0
        lineno = string.find(line, stext)
        if lineno >0:
            line =line.replace(stext, rtext)

        sys.stdout.write(line)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号