Python2.x 版本里面, 3种形式变量的使用调用
#python2.x版本中的raw_input 在python3版本中已经变成input #raw_input 2.x = input 3.x
#******************第一种*******************
name = input("name:") age = input("age:") job = input("job:") info = ''' ----------info - %s ---------- Name: %s Age: %s Job: %s '''% (name,name,age,job) print (info)
#******************第二种********************
name = input("name:") age = input("age:") job = input("job:") info = ''' ----------info - {0} ---------- Name: {0} Age: {1} Job: {2} '''.format(name,age,job) print (info)
#******************第三种********************
name = input("name:") age = input("age:") job = input("job:") info = ''' ----------info - {name} ---------- Name: {name} Age: {age} Job: {job} '''.format(name=name, age=age, job=job) print (info)