码迷,mamicode.com
首页 > 其他好文 > 详细

用户输入 - 002课

时间:2017-10-30 23:55:10      阅读:164      评论:0      收藏:0      [点我收藏+]

标签: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

 

用户输入 - 002课

标签:string   hat   you   odi   span   必须   password   inpu   imp   

原文地址:http://www.cnblogs.com/LXXXI/p/7758124.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!