# -*- coding: utf-8 -*-
"""
Created on Mon Nov 21 2022
@author: MMG
"""
# coding=utf-8
import os
path = "F:\\stratus cloud_30"
# new_path = "E:\\Program Files\\Mod5.2.2\\rural=5_view=136\\1"
def listfiles(dirpath):
filelist = []
for root, dirs, files in os.walk(dirpath):
for fileObj in files:
filelist.append(os.path.join(root, fileObj))
return filelist
def main():
filelist = listfiles(path)
for fileobj in filelist:
f = open(fileobj, 'r+')
lines = f.readlines()
f.seek(0)
f.truncate()
for line in lines:
f.write(line.replace('176.000000','166.000000'))
f.close()
if __name__ == main():
main()
Ps:时间久了,忘了是哪位大神写的!!!仅个人记录。