Ответ 1
В Python 3 печать - это функция, вам нужно называть ее как print("hello world")
.
Почему Python дает мне синтаксическую ошибку в простой инструкции print
в строке 9?
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","")
Версия Python:
Python 3.2.2 (default, Sep 4 2011, 09:07:29) [MSC v.1500 64 bit (AMD64)] on win
32
В Python 3 печать - это функция, вам нужно называть ее как print("hello world")
.
Используйте print("use this bracket -sample text")
В Python 3 print "Hello world"
отображается неверная синтаксическая ошибка.
Для отображения содержимого строки в Python3 необходимо использовать скобки ("Hello world")
.