Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python Exercise Example 7

Python Exercise Example 7

Python 100 Examples Python 100 Examples

**Problem:** Copy the data of one list into 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 Examples Python 100 Examples