#进行交互, Row_input is equivalent to input in Python3.
1 username = input ("Username:")2 job = input (" Your job:")3 age = Int (input ("your Age:"# string into int
#字符串拼接 ↓
1info =" "2 ------Now--------------3 Name:" "+ Username +" "4 Job:" "+ Job +" "5 " "6 #----------------------7Info_2 =" "8 ------now_2--------------9 name:%s #字符串stringTen job:%s One age:%d #只能是int A " "%(username,job,age) - -Info_3 =" " the ------Now_3-------------- - Name:{name_1} - job:{job_2} - Age:{age_3} + " ". Format (Name_1=username,job_2=job,age_3=age)#parameters inside {} can be defined by themselves - + Print(Info,'\ n') A Print(info_2) at Print(Info_3) - #Judging Type - Print(Type (age))
#输出结果
1 USERNAME:GDR2 your job:it3Your age:244 5------Now--------------6 NAME:GDR7 Job:it8 9 Ten One------Now_2-------------- AName:gdr#Strings String - Job:it -Age:24#can only be int the - -------Now_3-------------- - NAME:GDR + Job:it -Age:24 + A<class 'int'>
Python User interaction Program