方法一:
import shutil with open(‘/path/to/file‘, ‘r‘) as f: with open(‘/path/to/file.new‘, ‘w‘) as g: for line in f.readlines(): if ‘/local/server‘ not in line: g.write(line) shutil.move(‘/path/to/file.new‘, ‘/path/to/file‘)
方法二:
将文本中的 tasting123删除
1 2 3 4 5 6 7 8 |
|
时间: 2024-10-18 18:16:14