Python2.x 3種形式變量的使用調用python
#python 變量使用 #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)