在访问JIRA时,我正在尝试访问项的from
属性。Python给了我一个语法错误。可能是什么问题?
for history in changelog.histories:
for item in history.items:
if (item.field.upper() == 'SPRINT'):
try:
if item.fromString:
sFromSprint = str(100) #python does not like item.from
else:
sFromSprint = str(iZERO)
错误:
iFromSprint = item.from
^
SyntaxError: invalid syntax
from
是python 中的保留关键字
您可以使用getattr(item,'from')
来获取属性。