我正在尝试捕获超过1000行的内容。
因此,我尝试将每个内容添加到列表中,以便随后可以使用它。
import os
import json
from azure import *
from azure.storage import *
from azure.storage.table import TableService, Entity
import datetime
def Retrives_datas():
twenty_hours_before_now = datetime.datetime.now() - datetime.timedelta(days=1)
now = twenty_hours_before_now.isoformat()
filter = "Timestamp gt datetime'" + now + "'"
maker = None
i=0
table_service = TableService(account_name='MyAccount', sas_token='MySAS')
while True:
tasks = table_service.query_entities('MyTable', filter = filter, timeout=None, num_results=1000, marker=maker)
for task in tasks:
i += 1
print(i,tasks.items[i]['Status'])
if tasks.next_marker != {}:
maker = tasks.next_marker
else:
break
我得到以下错误:
999成功
回溯(最近通话最近): print(i,tasks.items [i] ['Status'])IndexError:列表索引超出范围
知道我在更换时
print(i,tasks.items[i]['Status'])
通过
print(i)
我得到2770多行。