Python Practice Example 7
Problem:Copy the data of one list to another list.
Program analysis:Use list[:].
Program source code:
Example
#!/usr/bin/python
# -*- coding: UTF-8 -*-
a = [1, 2, 3]
b = a[:]
print (b)
The output of the above example is:
[1, 2, 3]Other extensions
Python 100 Examples