1、基础参数定义实例
print("hello world")
name = "PaoChe Ge"
name2 = name
duohang = '''
print("My name is",name)
name = "Mr Li"
print(name2,"and",name)
'''
print(duohang) #打印duohang 多行!
username = input("username:")
password = input("password:")
print(username,password) #打印多个参数
2、打印输出:
name = input("name:")
age = int(input("age:") )
print(type(age) , type( str(age) ))
job = input("job:")
salary = input("salary:")
#不建议这种拼接方式,效率低下
info = '''
---------------info of ----------
Name: ''' + name + '''
Age: ''' + age + '''
Job:'''+ job + '''
Souru:'''+ souru +'''
'''
info1 ='''
---------------info of %s ----------
ame:%s
Age:%d
Job:%s
Salary:%s
''' % (name,name,age,job,salary)
info2 = ''' #建议这种方式
---------------info of {_name} ----------
Aame:{_name}
Age:{_age}
Job:{_job}
Salary:{_salary}
'''.format(_name=name,
_age=age,
_job=job,
_salary=salary)
info3 = '''
---------------info of {0} ----------
Aame:{0}
Age:{1}
Job:{2}
Salary:{3}
'''.format(name,age,job,salary)
#print(info1)
print(info3)