“Salinan Python Deep” Kode Jawaban

Objek klon Python

import copy

new_ob = copy.deepcopy(old_ob)
Sasso

Salinan Python Deep

import copy

l1 = [1,3,[9,4],6,8]
l2 = copy.copy(l1) #Making a shallow copy

print('List 1 = ', l1)
print('List 2 = ', l2)

print('Performing change in list 2')
l2[2][0] = 5

print('List 1 = ',l1)
print('List 2 = ',l2)
Mighty Unicorn

Jawaban yang mirip dengan “Salinan Python Deep”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya