标签:string hat you odi span 必须 password inpu imp
用户输入
#-*- coding:utf-8 -*- name=input("What is you name ?") print("Hello",name)
name=input("Name:") age=input("Age:") job=input("Job:") salary=input("Salary:") info=‘‘‘ ------------ info of %s ------------ Name:%s Age:%s Job:%s Salary:%s ------------------------------------- ‘‘‘%(name,name,age,job,salary) #string 字符串 print(info)
name=input("Name:") age=int(input("Age:")) int=integer 把数据类型转化为数字 print(type(age)) 打印数据类型 job=input("Job:") salary=input("Salary:") info=‘‘‘ ------------ info of %s ------------ string Name:%s Age:%d d 要求输入必须是数字 Job:%s Salary:%s ------------------------------------- ‘‘‘%(name,name,age,job,salary) print(info)
name=input("Name:") age=int(input("Age:")) print(type(age)) job=input("Job:") salary=input("Salary:") info=‘‘‘ ------------ info of{_name} ------------ Name:{_name} Age:{_age} Job:{_job} Salary:{_salary} ------------------------------------- ‘‘‘.format(_name=name,_age=age,_job=job,_salary=salary) print(info)
name=input("Name:") age=int(input("Age:")) print(type(age)) job=input("Job:") salary=input("Salary:") info=‘‘‘ ------------ info of{0} ------------ Name:{0} Age:{1} Job:{2} Salary:{3} ------------------------------------- ‘‘‘.format(name,age,job,salary) print(info)
1 username=input("username:") 2 password=input("password:") 3 print(username,password)
1 import getpass 2 username=input("username:") 3 password=getpass.getpass("password:") 4 print(username,password) 5 6 7 ***password
标签:string hat you odi span 必须 password inpu imp
原文地址:http://www.cnblogs.com/LXXXI/p/7758124.html