Python Practice Example 7

Python 100例Python 100 Examples

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]

Python 100例Python 100 Examples

Other extensions