问题描述
我试图在访问 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')
来获取属性。