知识点:
1、变量定义和引用
第一个字符必须是字母表中的字母(大写或小写)或者一个下划线
其他部分可以由字母(大写或小写)、下划线(‘ _ ’)或数字(0-9)组成
对大小写敏感
2、''',"""的使用
指示一个多行的字符串
——————————————————————————————————
按格式打印用户输入信息
#!/usr/bin/env python
#filename : variable
#formatting output variable
name = raw_input('please input your name:')
age = raw_input('how are you old?')
sex = raw_input("please input your gender?")
dep = raw_input("which are your work department?")
print "%s is a men." % name ---------变量引用
print '''The information of %s: --------'''
name: %s
age : %s
sex : %s
dep : %s
'''%(name, name, age, sex, dep) -----'''+多变量引用
运行结果:
C:\Users\d\Desktop>python variable.py
please input your name:cuijuntao
how are you old?25
please input your gender?M
which are your work department?IT
cuijuntao is a men.
The information of cuijuntao:
name: cuijuntao
age : 25
sex : M
dep : IT