首页 > 编程语言 > 详细

python中raw_input() 与 input()

时间:2015-07-16 19:27:48      阅读:217      评论:0      收藏:0      [点我收藏+]

参考网址: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

 

python中raw_input() 与 input()

原文:http://www.cnblogs.com/wangkongming/p/4651931.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!