gpt4 book ai didi

python - 如何使用 Python 访问检索到的列表的元素(来自 Harvest)

转载 作者:太空宇宙 更新时间:2023-11-04 02:26:34 25 4
gpt4 key购买 nike

类型(harvest.clients())输出:列表

harvest.clients()[0]输出:

OrderedDict([(u'client',
OrderedDict([(u'id', 2793223),
(u'name', u'1 TEMPLATES'),
(u'active', True),
(u'currency', u'Australian Dollar - AUD'),
(u'updated_at', u'2014-09-14T22:48:29Z'),
(u'created_at', u'2014-09-14T22:48:29Z'),
(u'default_invoice_timeframe', None),
(u'address', u''),
(u'currency_symbol', u'$'),
(u'details', u''),
(u'last_invoice_kind', None)]))]

我如何访问客户 ID、名称、事件、货币等?

最佳答案

client = harvest.clients()[0]['client']
print(client['id'])
print(client['name'])
print(client['active'])
print(client['currency'])

引用https://docs.python.org/3/library/collections.html#collections.OrderedDict

关于python - 如何使用 Python 访问检索到的列表的元素(来自 Harvest),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50244398/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com