Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python打印语句“;语法错误:无效语法”;_Python_Python 3.x_Syntax_Syntax Error - Fatal编程技术网

Python打印语句“;语法错误:无效语法”;

Python打印语句“;语法错误:无效语法”;,python,python-3.x,syntax,syntax-error,Python,Python 3.x,Syntax,Syntax Error,为什么Python在第9行的简单print语句中给我一个语法错误 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

为什么Python在第9行的简单
print
语句中给我一个语法错误

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

在Python3中,print是一个函数,您需要像调用
print(“hello world”)
使用
print(“使用此括号-示例文本”)

在Python3
中,打印“Hello world”
给出了无效的语法错误

要在Python3中显示字符串内容,必须使用此
(“Hello world”)
括号