Metadata-Version: 1.0 Name: txrestapi Version: 0.2 Summary: Easing the creation of REST API services in Python Home-page: http://github.com/iancmcc/txrestapi Author: Ian McCracken Author-email: ian.mccracken@gmail.com License: MIT Description: UNKNOWN Platform: UNKNOWN
python2
有 input 和 raw_input 两个函数
input 传入值的时候 会区别 类型
传值给a ,1的时候,a的值就为1,为数值型变量
1 2 3 4
>>> a = input("input:") input:1 >>> a 1
传给a HHH 的时候会报错,因为没有定义
1 2 3 4 5 6
>>> a = input("input:") input:HHH Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 1, in <module> NameError: name 'HHH' is not defined
如果要传字符串要用 “HHH”,这个时候a为字符串变量
1 2 3 4 5
>>> a = input("input:") input:"HHH" >>> a 'HHH' >>>
raw_input 传递进去的统一被认为字符串
传值给a ,1的时候,a的值为1,为字符串
1 2 3 4
>>> a = raw_input("input:") input:1 >>> a '1'
传值给a ,HHH的时候,a的值为HHH,也是为字符串
1 2 3 4
>>> a = raw_input("input:") input:HHH >>> a 'HHH'
传值给a ,”HHH” 的时候,a的值为”HHH”,也是为字符串
1 2 3 4 5
>>> a = raw_input("input:") input:"HHH" >>> a '"HHH"' >>>