python把txt中查找到的数字,按顺序替换为(1284, 533), (2416, 130), (1288, 538), (1310, 539), (1318, 533),请给出Python代码
时间: 2023-03-05 10:57:29 浏览: 69
查找替换代码
答:代码如下:with open("test.txt") as f:
data = f.read()
data = data.replace("1284", "533").replace("2416", "130").replace("1288", "538").replace("1310", "539").replace("1318", "533")with open("test.txt", "w") as f:
f.write(data)
阅读全文