1

三种拼接字符串方式:

a='aa'

b ='bb'

msg0 ='''

a:%s

b:%s

'''%(a, b)

msg1 ='''

a:{_a}

b:{_b}

'''.format(_a=a,_b= b)

msg2 ='''

a:{0}

b:{1}

'''.format(a, b)

while for特殊用法:

while else   for  else

she浅拷贝:

importcopy

name = ['aa','bb','cc',['dd','ee','ff','gg']]

name2 = name.copy()

name3 = copy.copy(name)

name4 = copy.deepcopy(name)

name[0] ='AA'

name[3][0] ='DD'

print(name)

print(name2)

print(name3)

print(name4)

----> ['AA', 'bb', 'cc', ['DD', 'ee', 'ff', 'gg']]

['aa', 'bb', 'cc', ['DD', 'ee', 'ff', 'gg']]

['aa', 'bb', 'cc', ['DD', 'ee', 'ff', 'gg']]

['aa', 'bb', 'cc', ['dd', 'ee', 'ff', 'gg']]

你可能感兴趣的:(1)