lundi 23 février 2015

NameError in Python using if [on hold]

I'm new of Python and i'm stuck on this. I need to check if i can find an string in a file.



InputEAN=input()
EAN = open("/home/master/Documenti/Progetti/eanFZ.txt","r")
riga=EAN.readlines()
EAN.close()
for i in range(len(riga)):
if inputEAN == riga[i]:
print "oK"


After i put something as input i have this is the Output Error:



Traceback (most recent call last):
File "ContEAN.py", line 8, in <module>
if inputEAN == riga[i]:
NameError: name 'inputEAN' is not defined

Aucun commentaire:

Enregistrer un commentaire