5
我在編寫一個腳本,寫出Google Docs Spreadsheet,當我運行它時,我得到標題中的錯誤。更具體地講:AttributeError:'str'對象沒有任何屬性'iteritems'
File "/home/pi/Desktop/templog.py", line 44, in <module>
s.run()
File "/usr/lib/python2.7/sched.py", line 117, in run
action(*argument)
File "/home/pi/Desktop/templog.py", line 35, in do_something
entry = spr_client.InsertRow(data_str, spreadsheet_key, worksheet_id)
File "/usr/local/lib/python2.7/dist-packages/gdata/spreadsheet/service.py", line 330, in InsertRow
for k, v in row_data.iteritems():
AttributeError: 'str' object has no attribute 'iteritems'
的一塊,是造成這個代碼是:
entry = spr_client.InsertRow(data_str, spreadsheet_key, worksheet_id)
if isinstance(entry, gdata.spreadsheet.SpreadsheetsList):
我認爲'InsertRow'期望第一個參數是一個將值映射到列名的字典,而不是字符串。 – eldarerathis
你是對的我想 - 謝謝你的回覆。 – user1813343