發現錯誤試圖運行我的代碼時,我不斷收到一個錯誤:不能在Python代碼
Traceback (most recent call last):
File "E:\healthtest.py", line 3, in <module>
if raw_input() == "Hit":
NameError: name 'raw_input' is not defined
我不知道我做錯了什麼,但這裏是我一直在使用的代碼。
health = "10"
if raw_input() == "Hit":
health = health - 5
我希望你能幫助我,並提前致謝。
[**'raw_input' **](HTTPS://docs.python .org/2/library/functions.html#raw_input)是Python 2.7。 –
可能的重複[如何在Python 3.1中使用raw \ _input](http://stackoverflow.com/questions/954834/how-do-i-use-raw-input-in-python-3-1) –