【指针检测项目】python 遍历csv中的每一个数据,并作判断

  with open('outfile.csv', 'r', encoding='gbk') as csvfile:
      reader = csv.reader(csvfile)
      j = 0
      for i, rows in enumerate(reader):
          if i == j:
              row = rows
              print(row)
              j = j + 1
              if row[0] == 'light':
                  if row[2] > '0.8' or row[3] > '0.8':
                      open("D:\\models-master\\models-master\\research\\object_detection2\\send.txt", "w+").write("0")
                      found = '{}: {}, 宽度{}mm, 高度{}mm'.format(row[0], row[1], row[2], row[3])
                      list4.append(found)
                      storFile(list4, "result_out.csv")
                      print(found)

你可能感兴趣的:(工程项目,python)