import re
f_in = open("C:/log/2016_06_29/male1.1.tgf")
f_out = open("C:/log/2016_06_29/male1.0.tgf", "w")
lines = f_in.readlines()
for line in lines:
num = int(re.match(r"\d+", line).group(0))
num = num + 1
pos = re.match("\d+",line).end()
line = line[pos:]
f_out.write("%d %s" % (num, line))
print("increase done!")
f_out.close()
f_in.close()
Increase the ordinal number at the beginning of each line
最新推荐文章于 2021-12-03 16:19:59 发布