Warum gibt Python bei der einfachen Anweisung print
in Zeile 9 einen Syntaxfehler aus?
import hashlib, sys
m = hashlib.md5()
hash = ""
hash_file = raw_input("What is the file name in which the hash resides? ")
wordlist = raw_input("What is your wordlist? (Enter the file name) ")
try:
hashdocument = open(hash_file,"r")
except IOError:
print "Invalid file." # Syntax error: invalid syntax
raw_input()
sys.exit()
else:
hash = hashdocument.readline()
hash = hash.replace("\n","")
Die Version von Python ist:
Python 3.2.2 (default, Sep 4 2011, 09:07:29) [MSC v.1500 64 bit (AMD64)] on win
32
In Python 3 ist print eine Funktion, die Sie wie print("hello world")
aufrufen müssen.
Benutze print("use this bracket -sample text")
In Python 3 print "Hello world"
liefert einen ungültigen Syntaxfehler.
Um den Inhalt von Strings in Python3 anzuzeigen, muss ("Hello world")
Klammern.