Programme chap2_type_1251_.py


# coding: latin-1
import copy
l  = [[1,2,3],[4,5,6]]
l2 = copy.copy (l)
l3 = copy.deepcopy (l)
l [0][0] = 1111
print l                # affiche [[1111, 2, 3], [4, 5, 6]]
print l2               # affiche [[1111, 2, 3], [4, 5, 6]]
print l3               # affiche [[1, 2, 3], [4, 5, 6]]
print l is l2          # affiche False
print l [0] is l2 [0]  # affiche True
print l [0] is l3 [0]  # affiche False

créé avec py2html version:0.62