Python(GoogleSheetsAPI)-搜索某个字符串并返回第二个单元格
在这个问题中,我使用了代码,但我只需要从第二个单元格返回值(如果python找到,则从整行返回) 我尝试以下代码: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.
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])(您不需要加入
)。我是“盲的”。。。谢谢。:)