얕은복사1 copy - shallow, deep : 깊은복사, 얕은복사 list >>> num_list = [1,2,3,4] # deep copy >>> new_list = num_list[:] >>> new_list2 = list(num_list) set >>> str_set = {'Jane', 'Tim', 'John'} # deep copy >>> new_set = str_set.copy() dict >>> str_dict = {'hi': 'world'} # deep copy >>> new_dict = str_dict.copy() use copy module >>> import copy >>> object = 'other something object' >>> new_obj = copy.copy(object) # shallow copy >>> new_obj2 = copy.. 2020. 8. 19. 이전 1 다음