我可以使用python使用issue.fields.attachment
显示jira中的附件attach_list = issue.fields.attachment print attach_list print attach_list[0] print attach_list[1]
输出
[<JIRA Attachment: filename=u'test.xlsx',
id=u'525427',
mimeType=u'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'>,
<JIRA Attachment: filename=u'test2.csv',
id=u'525515',
mimeType=u'application/vnd.ms-excel'> ]
test.xlsx
test2.csv
如何从该列表中检索ID。在上面的例子中,我需要检索525427
请建议我?
答案 0 :(得分:3)
只需访问id
属性:
attach_list[0].id
如果您需要id
列表,请使用list comprehension:
attach_list = issue.fields.attachment
id_list = [attach.id for attach in attach_list]