我希望得到这样的结果
用户输入此=> (设置my_number 4444) 程序打印此=> (my_number => 4444) 目前我正在处理这个,我无法弄清楚
number1 = raw_input ('enter your number > ')
print ('number => ' + number1);sleep(2)
答案 0 :(得分:1)
采取:
number = raw_input("Enter your number:")
number = number.split(" ")[-1]
print("my_number => "+str(number))
答案 1 :(得分:0)
import re
from time import sleep
number1 = raw_input ('enter your number > ')
print ('number => ' + re.search(r'\d+[\.\d+]*', number1).group());
sleep(2)
检查这是否有帮助