“Python Deep Copy” Code-Antworten

Python -Klonobjekt

import copy

new_ob = copy.deepcopy(old_ob)
Sasso

Python Deep Copy

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

Ähnliche Antworten wie “Python Deep Copy”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen