- 思考下面三条语句,它们会改变A打印出的值吗?
A = 'spam'
B = A
B = ‘shrubbery‘
不会
- 思考下面三条语句,它们会改变A打印出的值吗?
A = ['spam']
B = A
B[0] = ‘shrubbery‘
会
- 思考下面三条语句,它们会改变A打印出的值吗?
A = ['spam']
B = A[:]
B[0] = ‘shrubbery‘
不会
A = 'spam'
B = A
B = ‘shrubbery‘
不会
A = ['spam']
B = A
B[0] = ‘shrubbery‘
会
A = ['spam']
B = A[:]
B[0] = ‘shrubbery‘
不会