pen_color = input("Enter a color name to set the pen color: ")
pen_width = input("Enter a number from 1-10 to set the pen width: ")
有更給它,但它打開了,並要求顏色和我的色彩類型,那麼它只是關閉說Syntax error: Unexpected EOF while parsing.
語法錯誤
pen_color = input("Enter a color name to set the pen color: ")
pen_width = input("Enter a number from 1-10 to set the pen width: ")
有更給它,但它打開了,並要求顏色和我的色彩類型,那麼它只是關閉說Syntax error: Unexpected EOF while parsing.
語法錯誤
input()
提示輸入一個字符串,然後eval()
它。使用raw_input()
。
在Python 2.x中,input()
會嘗試計算您作爲Python表達式輸入的字符串。如果這不是您想要的,並且您使用的是Python 2.x,則應該使用raw_input()
而不是input()
。
This has changed in Python 3.x,其中input()
不再評估輸入,並且raw_input()
不再存在。因此在Python 3.x中,input()
將是正確的函數。
在Python 2.x的:
input() = eval(raw_input())
在Python 3
這不再是的情況下,是input()
一樣在Python 2.x的raw_input()
改爲使用'raw_input'。 – eumiro
除非他/她使用Python 3. – akaIDIOT
這兩行是否構成一個程序?什麼是上下文?你如何輸入看起來像? – glglgl