Latest web development tutorials

Python Exercise Example 7

Python 100 Li Python 100 Li

Topic: Copying data from one list to another list.

Program analysis: using the list [:].

Source Code:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

a = [1, 2, 3]
b = a[:]
print b

The above example output is:

[1, 2, 3]

Python 100 Li Python 100 Li