import re
f_in = open("C:/work_files/libigl/tutorial/shared/male1.tgf")
f_out = open("C:/work_files/libigl/tutorial/shared/male1.o.tgf", "w")
for row in range(1,17914):
line = f_in.readline()
pos = re.search(" 0(?!.* 0)",line).start()
line = line[:pos]
f_out.write("%d %s\n" % (row, line))
print("adding done!")
f_out.close()
f_in.close()
add line order to each line and remove the last match of each line
最新推荐文章于 2024-07-15 17:53:06 发布