Description: The version used by the author is python3.6
First, let's talk about Python's three format output. The first one uses the format operator%, and when formatting the string, Python uses a string as the template. There are formatting characters in the template that reserve locations for real values and describe the format in which real values should be rendered.
Python uses a tuple (tuple) to pass multiple values to the template, each of which corresponds to a format character.
The second use of the Format method, please read the code carefully.
1 #Author:yang2Name=input ("Name:")3Age=input ("Age :")4Job=input ("Job:")5info=" "6 ----------Info of%s------------7 name:%s8 age:%s9 job:%sTen " "%(name,name,age,job) OneInfo2=" " A ---------Info of {0}----------- - name:{0} - Age:{1} the job:{2} - " ". Format (name,age,job) -info3=" " - ---------info of {na}----------- + Name:{na} - Age:{ag} + JOB:{JB} A " ". Format (na=name,ag=age,jb=job) at Print(Info) - Print(Info2) - Print(INFO3)
Second, to say a different case of the assignment, see the following code:
Code (1)
a=[1,2,3]
B=a
A.append (4)
Print (a)
Print (b)
Code (2)
a=[1,2,3]
B=a
a=[4,5,6]
Print (a)
Print (b)
A list assignment is not a full copy, but a two variable pointing to the same piece of memory on the computer.
Python Learning (first article)