hello= input("please input your name, gay:")
print "Hello,",hello
1.为啥输入整型就可以,输入字符就不行撒
2.还有就是print('dd')和print("dd")有啥区别?
input function in Python 2.7, evaluates whatever your enter, as a Python expression. If you simply want to read strings, then use raw_input function in Python 2.7, which will not evaluate the read strings
hello= raw_input("please input your name, gay:")
1.输入字符串的时候加上单引号或者双引号
2.单引号和双引号用法都是一样的,但是如果字符串里有相同的字符时要使用\进行转义
参考:
http://blog.csdn.net/linda1000/article/details/8315892
http://zhidao.baidu.com/link?url=38o2wfdwn1G-qizAePD1M9-oiSuVGxjmN_s-T1jZPEbN3WQPn3Hq_eNYef_u9X0yHGHrlWIYp14FV9CxQ9lRBbY8M1dAEzjrPUGsz9tGWnO
那请问怎样可以直接输入chen,而不报错呢,我试过类型转换,好像行不通捏
#coding=utf-8
2.7的话,用raw_input()