发布时间:2019-07-15 10:54:04编辑:auto阅读(1687)
#交互式输出
#!/usr/bin/env python # -*- coding:utf-8 -*- name = input("what is your name?") password = input("Please enter password?") print(name, password) 执行输出: what is your name?xcn Please enter password?admin@1234 xcn admin@1234
#交互式格式输出
#!/usr/bin/env python # -*- coding:utf-8 -*- name = input("name:") age = input("age:") job = input("job:") salary = input("salary:") info = ''' -----------info %s------------- name : %s age : %s job : %s salary : %s ''' % (name, age, job, salary) print(info) 执行输出: name:xcn age:20 job:12 salary:2000 -----------info xcn------------- name : 20 age : 12 job : 2000 salary : 123 #注释: % 相当于shell 中的$ s 相当于string 字符串
#定义打印(print)类型
#!/usr/bin/env python # -*- coding:utf-8 -*- age = int(input("age:")) print(type(age), type(str(age)))
上一篇: python pip源配置
下一篇: Centos 6.4 安装python
47483
45786
36784
34310
28955
25589
24436
19606
19096
17626
5458°
6041°
5557°
5632°
6558°
5370°
5370°
5877°
5850°
7163°