删除重复数据并使用python在Google表格中输入

时间:2019-05-29 03:54:17

标签: python opencv google-sheets-api

我有一个关于人脸识别的项目,其结果在Google表格中提交

当前,我使用树莓派,谷歌表API和python

for(x,y,w,h) in faces:
    cv2.rectangle(img, (x,y), (x+w,y+h), (0,255,0), 2)
    id, confidence = recognizer.predict(gray[y:y+h,x:x+w])
    # Check if confidence is less them 100 ==> "0" is perfect match 
    if (confidence < 100):
        id = names[id]
        confidence = "  {0}%".format(round(100 - confidence)) 
        lcd.message(id)
        row = (id,datetime.datetime.now().strftime('%Y-%-m-%d %H:%M:%S'))
        index = 2
        sheet.insert_row(row,index)
        data  = sheet.get_all_records()
        def removeDupl(inputList):
          secondList = []
          for element in inputList:
            if element not in inputList:
               secondList.append(element) 
          return secondList
        data = removeDupl(data)

我已经使用了.append方法,但结果是,在Google表格中输入的数据仍然可以接收相同的数据。在Google表格的“ A2”中输入数据,有人可以提供帮助吗?谢谢你

0 个答案:

没有答案