delete specific lines in a set of files in a folder

import os 

myinst = ['foo','bar']

def wipe_lines(folder):
    for (dirpath, dirnames, filenames) in os.walk('/Users/faramir/git/'+ folder):
        for filename in filenames:
            f = open(os.sep.join([dirpath, filename]),"r")
            lines = f.readlines()
            f.close()
            f = open(os.sep.join([dirpath,filename]),"w")
            for line in lines:
                if not line in copyright:
                    f.write(line)

for x in ['mos','unittest']:
    wipe_lines(x)


实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值