簡體   English   中英

訪問單元格歷史記錄(python,smartsheets)

[英]Accessing Cell history (python, smartsheets)

我正在尋找一種訪問單元歷史記錄元素的方法。 我已經使用以下代碼的各種迭代來獲取單元格歷史記錄字典中的鍵,但是(顯然)我在做錯事。 當按如下方式運行代碼時,出現此錯誤TypeError: 'CellHistory' object has no attribute '__getitem__'

救命! 這真讓我抓狂!

#get the cell history
action = smartsheet.Cells.get_cell_history(
    sheetid,
    sheet.rows[1].id,
    columns[1].id,
    include_all=True)

 revisions = action.data

#print out something from revision history
for rev in revisions:
    print rev['modifiedAt'] #breaks here`

似乎您在print語句中使用了錯誤的屬性名稱和語法。 嘗試這樣的事情:

#print out revision history
for rev in revisions:
    print(rev.modified_at)
    print(rev.modified_by.name)
    print('')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM