Python语法错误?可能是缩进问题

Python语法错误?可能是缩进问题,python,indentation,Python,Indentation,嗨~我在Python中有一个语法错误: while true: print("Please type your name.") name = input() if name == "your name": break print("Thanks!") 但是看起来代码“print(谢谢!)”有语法错误~我不知道为什么~谢谢 为Python 2.7使用下面的代码 永远不要问你的语法问题。 while True: print("Please type

嗨~我在Python中有一个语法错误:

while true:
    print("Please type your name.")
    name = input()
    if name == "your name":
        break
print("Thanks!")

但是看起来代码“print(谢谢!)”有语法错误~我不知道为什么~谢谢

为Python 2.7使用下面的代码 永远不要问你的语法问题。

while True:
    print("Please type your name.")
    name = raw_input()
    if name == "your name":
        break
print("Thanks!")

true
应为
true
。除此之外,我不知道您看到了什么问题。
namererror:name'true'未定义
除此之外,此代码工作正常。它应该是
而true
您使用的是哪种Python版本?我使用的是Python 3.7