您的位置:首页 > 编程语言 > Python开发

python修改文件内容

2014-02-28 23:01 561 查看
def func(filename): input = open(filename) lines = input.readlines() input.close() output = open(filename,'w') for line in lines: if not line: break if (('appdef.h' in line) and ('include' in line) ): temp = line.split("appdef") temp1 = temp[0] + 'datatype'
+ temp[1] output.write(temp1) else: output.write(line) output.close()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: