参考网址:http://www.cnblogs.com/way_testlife/archive/2011/03/29/1999283.html
在python中如何接收一个输入的字符串。
举个例子:
#coding=utf-8 #测试input 和 raw_input x = input("please input :") print x
运行:python 23.py
输入一个数字
please input :9 9
输入一个字符串
please input :aaa Traceback (most recent call last): File "23.py", line 3, in <module> x = input("please input :") File "<string>", line 1, in <module> NameError: name ‘aaa‘ is not defined
时间: 2024-10-26 01:56:16