四、python用户交互程序

一、注释

1、单行,代码注释:#

 2、多行注释:三个引号(单引号、或双引号)

 3、三个单引号,赋予个变量,打印,又可用作:多行打印

 4、单行打印

msg1 = '''sjijid = ddcd'''
#单引号套双引号,双套单
msg2 = "I'm lili"
print(msg1,msg2)

 5、账号密码,输入框:

一种:

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

 二种:

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

info = '''
----- info of %s -------
name:%s
job:%s
''' % (name,name,job)
print(info)

 #str转换成int
age = int(input("age:"))

#打印字符类型,把age转为字符串str(age)
print(type(age),type(str(age)))


#d:整数、f:小数
age:%s
 
原文地址:https://www.cnblogs.com/liu1-/p/12795495.html