我正在尝试学习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@localhost python3.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
发布于 2018-06-13 04:05:05
前一行缺少右括号:
print(formatter.format("one", "two", "three", "four"))
# This was missing ----------------------------------^
https://stackoverflow.com/questions/50824760
复制相似问题