1 回答
TA贡献1864条经验 获得超6个赞
这应该有帮助。
changes = { u'status': u'MERGED', u'topic': u'master_e', u'updated': u'2018-09-04 05:40:19.000000000', u'insertions': 549, u'created': u'2017-08-31 08:03:05.000000000', u'change_id': u'I7ed2f8da71e38f4908acf92f36dd', u'hashtags': [], u'deletions': 178, u'submitted': u'2018-09-04 05:39:48.000000000', u'submittable': False, u'project': u'testdemo', u'branch': u'master', u'owner': { u'username': u'usertest', u'email': u'user@abc.com', u'name': u'userdemo', u'_account_id': 36710 }, u'_number': 71090131, u'id': u'fm~master~I7ed71f4908acf92f36ddac3ff85b271e', u'subject': u'%TBC FC: OSS_FC_0 App_NBI: RESTful Web Service Data Access API- PM Support : add IUM scripts' }
data={'status':[], 'deletions':[], 'updated':[], 'insertions':[], 'created':[], }
for k, v in data.items():
if k in changes:
data[k].append(changes[k])
print(data)
输出:
{'status': [u'MERGED'], 'deletions': [178], 'updated': [u'2018-09-04 05:40:19.000000000'], 'insertions': [549], 'created': [u'2017-08-31 08:03:05.000000000']}
添加回答
举报