add line order to each line and remove the last match of each line

来源:互联网 发布:apache tiles3 教程 编辑:程序博客网 时间:2024/05/17 01:37
import ref_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()  

0 0
原创粉丝点击