I am trying to use the enumerate function in a script, but I get a name error.
for index, item in enumerate(dspy):
print index, item
Where dspy is a py dataset. Do I need to import a module to use this function?
I am trying to use the enumerate function in a script, but I get a name error.
for index, item in enumerate(dspy):
print index, item
Where dspy is a py dataset. Do I need to import a module to use this function?
I believe that enumerate() was introduced in Python 2.3 - FactoryPMI is running Python 2.1.
You’re going to have to go with the older style:
for index in range(len(dspy)):
item = dspy[index]
print index, item
Hope this helps,