#交互式输出
#!/usr/bin/env python#-*-coding:utf-8-*-name = input ("What is your name?") Password = input ("Please enter password?") Print (name, password) execution output: What is your name?xcnplease enter [email protected]xcn [email protected]
#交互式格式输出
#!/usr/bin/env python#-*-coding:utf-8-*-name = input ("Name:") Age = Input ("Age:") job = input ("job:") salary = input ("sa Lary: ") info = '-----------Info%s-------------Name:%sage:%sjob:%ssalary: '%s ' '% (name, age, job, salary) print (in FO) execution output: name:xcnage:20job:12salary:2000-----------Info xcn-------------name:20age:12job:2000salary:123# Note:% Equivalent to $s in the shell equals string string
#定义打印 (print) type
#!/usr/bin/env python#-*-coding:utf-8-*-age = Int (Input ("Age:")) print (type (age), type (str))
This article is from the "Little Rookie" blog, please be sure to keep this source http://baishuchao.blog.51cto.com/12918589/1932890
Python Interactive (input)