python学习随笔1:python用户交互

1.输入使用input

username = input("username:")
password = input("password:")

print(username,password)

2.输入打印出格式

name = input("name:")
age = input("age:")
job = input("job:")

info =‘‘‘_____info of %s____
name:%s
age:%s
job:%s
‘‘‘ %(name,name,age,job)

print(info)
name = input("name:")
age = input("age:")
job = input("job:")

info =‘‘‘_____info of name____
name:name
age:age
job:job
‘‘‘ .format(name=name,age=age,job=job)

print(info)

3.密码输入密文模块

import getpass

username = input("username:")
password = getpass.getpass("password:")

print(username,password)

相关推荐