python将字典添加到列表_Python:将值添加到字典内的列表中

试图从名为dow的变量向weekdays:[0]添加值。在create_data = {"startDateTime":"2015-02-23T09:05:00-0600","endDateTime":"2015-02-23T10:05:00-0600","accessories":[],"customAttributes":[{"attributeId":"3","attributeValue":""},{"attributeId":"5","attributeValue":"Yes"}],"description":"Placeholder Description","invitees":[],"participants":[],"recurrenceRule":[{"type":"weekly","interval":2,"weekdays":[0],"repeatTerminationDate":"2015-05-24T09:50:00-0600"}],"resourceId":"15","resources":["15"],"title":"","userId":"26","startReminder":"","endReminder":""}

我搞不清是在词典中添加还是在列表中添加。在

尝试了以下方法,但却产生了以下错误:

^{pr2}$

以下是错误。在Traceback (most recent call last):

File "api.py", line 51, in

create_data['recurrenceRule']['weekdays'] = dow

TypeError: list indices must be integers, not str

如何访问该值?在

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值