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()
python修改文件内容
最新推荐文章于 2022-10-24 17:09:37 发布