python 3.6.5出现语法错误

python 3.6.5出现语法错误,python,python-3.6,Python,Python 3.6,我正在努力学习python,由于某些原因,我不断地遇到语法错误。当我复习时,我看不出有什么错 操作系统版本: [root@localhost python3.6]# cat /etc/*release CentOS Linux release 7.5.1804 (Core) 版本: [root@localhost python3.6]# python3.6 -V Python 3.6.5 Python脚本: [root@localhostpython3.6]#cat ex8.py for

我正在努力学习python,由于某些原因,我不断地遇到语法错误。当我复习时,我看不出有什么错

操作系统版本:

[root@localhost python3.6]# cat /etc/*release
CentOS Linux release 7.5.1804 (Core) 
版本:

[root@localhost python3.6]#  python3.6 -V
Python 3.6.5
Python脚本: [root@localhostpython3.6]#cat ex8.py

formatter = "{} {} {} {}" 

print(formatter.format(1, 2, 3, 4))
print(formatter.format("one", "two", "three", "four")
print(formatter.format(True, False, False, True)) 
print(formatter.format(formatter, formatter, formatter, formatter)) 
print(formatter.format(
"Bing",
"Bong", 
"Bang", 
"Bung"
))
Python错误:

[root@localhost python3.6]# python3.6 ex8.py 
  File "ex8.py", line 5
    print(formatter.format(True, False, False, True)) 
        ^
SyntaxError: invalid syntax

前一行缺少右括号:

print(formatter.format("one", "two", "three", "four"))
# This was missing ----------------------------------^

在出现错误之前,数一数你的括号。谢谢!我想我在修复其他语法错误时忽略了这一点。