语料团队之前都是手动标注文字的定位位置,今天写了个小脚本,帮他们批量生成文字对应的定位。
其中数据生成后,要生成csv文件,查看了下使用csv库。
import csv
row1 = [1,2,3,4,5]
row2 = [1,2,3,4,5]
row3 = [1,2,3,4,5]
rows = [row1,row2,row3]
with open(csv_name,"w") as csvfile:
writer = csv.writer(csvfile)
#先写入columns_name
writer.writerow(["bottom", "left", "right", "top", "value"])
#写入多行用writerows
writer.writerows(rows)