Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python(GoogleSheetsAPI)-搜索某个字符串并返回第二个单元格_Python_Google Sheets - Fatal编程技术网

Python(GoogleSheetsAPI)-搜索某个字符串并返回第二个单元格

Python(GoogleSheetsAPI)-搜索某个字符串并返回第二个单元格,python,google-sheets,Python,Google Sheets,在这个问题中,我使用了代码,但我只需要从第二个单元格返回值(如果python找到,则从整行返回) 我尝试以下代码: sheet3 = client.open("sheet_name").worksheet('DATA') values = sheet3.findall("1") #try find value "1" in whole sheet for r in values: print(', '.join(sheet3.

在这个问题中,我使用了代码,但我只需要从第二个单元格返回值(如果python找到,则从整行返回)

我尝试以下代码:

sheet3 = client.open("sheet_name").worksheet('DATA')
values = sheet3.findall("1") #try find value "1" in whole sheet
for r in values:
     print(', '.join(sheet3.row_values(r.row)))
https://www.fincentrumreality.com/reality/pronajem-bytu-3-1-74-m2-ortenova%2c-jihlava-16899
我得到了这个:

Pronájem bytu 3+1 74 m2 Ortenova Jihlava, https://www.fincentrumreality.com/reality/pronajem-bytu-3-1-74-m2-ortenova%2c-jihlava-16899, , , , , , , , 1
但我只需要打印以下代码:

sheet3 = client.open("sheet_name").worksheet('DATA')
values = sheet3.findall("1") #try find value "1" in whole sheet
for r in values:
     print(', '.join(sheet3.row_values(r.row)))
https://www.fincentrumreality.com/reality/pronajem-bytu-3-1-74-m2-ortenova%2c-jihlava-16899
该值位于Google工作表的第二(2)个单元格中

但此代码不起作用(我只得到了空打印):


Python是零索引的。请尝试打印(sheet3.row\u值(r.row)[1])(您不需要加入
)。我是“盲的”。。。谢谢。:)