Contact: aviboots(AT)netvision.net.il
39,939 questions
51,876 answers
573 users
import copy list2D = [[1, 2, 3], [4, 5, 6], [7, 8, 9, 10]] cloned_list = copy.deepcopy(list2D) print(cloned_list) ''' run: [[1, 2, 3], [4, 5, 6], [7, 8, 9, 10]] '''
list2D = [[1, 2, 3], [4, 5, 6], [7, 8, 9, 10]] cloned_list = [row[:] for row in list2D] print(cloned_list) ''' run: [[1, 2, 3], [4, 5, 6], [7, 8, 9, 10]] '''