0
我想讓用戶輸入一張表的名字,table = str(input("table: "))
作品,但是每次只輸入'name'
而不是name
,有沒有什麼可以解決的呢?在python中,是否有輸入不帶引號的字符串?
我想讓用戶輸入一張表的名字,table = str(input("table: "))
作品,但是每次只輸入'name'
而不是name
,有沒有什麼可以解決的呢?在python中,是否有輸入不帶引號的字符串?
使用raw_input
:
table = raw_input("table: ")
輸入([提示])
Equivalent to eval(raw_input(prompt))
This function does not catch user errors. If the input is not syntactically valid, a SyntaxError will be raised. Other exceptions may be raised if there is an error during evaluation.
If the readline module was loaded, then input() will use it to provide elaborate line editing and history features.
Consider using the raw_input() function for general input from users.
http://stackoverflow.com/questions/4915361/whats-the-difference-between-原始輸入和輸入功能於python3-X – Suku