【发布时间】:2018-03-14 16:23:21
【问题描述】:
Python 的超级新手,我就是不知道是什么导致了我的代码中的错误消息...
It says '[pylint] E0001:invalid syntax (<string>, line 24)'.
谁能解释我在这里缺少什么?
非常感谢!
#########################################
# Draws a mario-style right-side-aligned half pyramid
# of the requested height.
# Restriction: 0 < height < 23
##########################################
while True:
height = int(input("Height: "))
if height > 0 and height < 23:
break
elif height == 0:
print()
print()
print()
print("I have drawn a pyramid with a height of 0!")
print("Isn't it pretty!")
exit(0)
hashes = 2
for i in range(height):
spaces = (height - hashes + 1)
for j in range(spaces):
print(" ", end="")
for k in range(hashes):
print("#", end="" )
print()
hashes += 1
【问题讨论】:
-
您能否包含您收到的 full 错误?另外,第 24 行是哪一行?
-
对不起!第 24 行是: print(" ", end="") 完整的消息是:severity: 'Error' message: 'E0001:invalid syntax (
, line 24)' at: '24,1' source :'pylint' -
你确定你使用的是 Python 3 吗?
-
您使用的是哪个版本的 Python?试试
import sys; print(sys.version) -
第 17 行还是第 24 行?是哪个?
标签: python python-3.x syntax-error