raw_input() 用于接收标准输入,并把标准输入当成字符串类型来处理,只能在 Python2 中使用,Python3 中没有这个函数
#!/usr/bin/env python #-*- coding:utf-8 -*- name = raw_input("Please input your name: ") age = raw_input("Please input your age: ") print type(name) print type(age)
[root@gd_center_47.102.137.164 ~]# python 1.py Please input your name: laowang Please input your age: 28 <type 'str'> <type 'str'>