for case in log:
for event in case:
if event in process_model:
index = process_model.index(event)
else: print(event, index)
---------- output-----------
NameError: name 'index' is not defined
我仍然需要使用索引
答案 0 :(得分:1)
这是你要找的吗?
for case in log:
for event in case:
if event in process_model:
index = process_model.index(event)
else:
index = None
print(event, index)
或者(如果情况有__repr__
方法并且您希望获得充分信息):
for case in log:
for event in case:
if event in process_model:
index = process_model.index(event)
else:
index = None
print(case, event, index)