def change(n): n[0] = 'Mr Gumby' names = ['Mrs Entity', 'Mrs. Thing'] change(names) print(names)
result:
['Mr Gumby', 'Mrs. Thing']
记住:字符串,数字, 元组是不可变的,即无法修改的。