我正在做一个项目,我正在python中从Google表格中读取数据。在这里,我将php脚本中的变量传递给python,然后在python中进行一些计算。现在我想将这些变量发送回php脚本来自python。我该怎么办?
username=sys.argv[1]
print(username)
for row in range(1,100):
if wks.cell(row,2).value== username:
n=row
break
print(n)
apti=0
if wks.cell(n,4).value == "1060":
apti+=1
if wks.cell(n,5).value == "20 yrs":
apti+=1
if wks.cell(n,6).value == "25":
apti+=1
if wks.cell(n,7).value == "250":
apti+=1
if wks.cell(n,8).value == "6":
apti+=1
if wks.cell(n,9).value == "12":
apti+=1
if wks.cell(n,10).value == "48":
apti+=1
if wks.cell(n,11).value == "1 and 2 only":
apti+=1
if wks.cell(n,12).value == "41":
apti+=1
if apti==9:
print('success')
else:
print ('Fail')
count=10
现在我想将count变量的值发送回php脚本
答案 0 :(得分:0)
欢迎来到SO。我认为您正在使用Google API读取单元格值并进行一些计算。我建议您将最终的价值写入工作表,然后尝试使用php接口从工作表中读取。因此,Google工作表将为您充当数据库。
# At the end of python case, update sheet with final value
sheet.update_cell(...)
要使用php读取更新后的Google表格,请参阅此处的文档:https://developers.google.com/sheets/api/quickstart/php
希望这会有所帮助!