我最近做了切換到Python 3和常規的東西,通常與Python 2的工作不能與Python 3的工作。我已經能夠解決其餘的問題,但我掙扎着與這個。我無法檢查什麼是「類型」。如何使其他工作python3
raw = input("Please give me a number, string\
or decimal: ")
if type(raw) == int:
print("You entered a number")
elif type(raw) == float:
print("You entered a decimal")
elif type(raw) == str:
print("You entered a string")
else:
print("error please try again")
`
它應該是你輸入的字符串:)是嗎? –