Ich schreibe ein Modul. Der Python-Code wird korrekt als python im.py kompiliert und gibt die Zeilenanzahl korrekt an.Python-Modul löst ungültigen Syntaxfehler
The error thrown when called >>>import im is
File "<stdin>", line 1
import im
^
SyntaxError: invalid syntax
def linecount(filename):
count = 0
for line in open(filename):
count +=1
return count
print(linecount('im.py'))
Irgendeine Idee warum?
'try' ist ein Schlüsselwort, also denke ich, dass Sie besser kein Paket' try' nennen. –