#import the print from the ffprint module as a function called pretty_print
from pprint import pprint as pretty_print

#imports the copy and deepcopy functions from the copy module
from copy import copy,deepcopy

nums_2d = [
    [1,2,3,4,5,6,7],
    [8,9,10,11,12,13,14,15],
    [16,17,18,19,20,21,22]
]
print(nums_2d[1][3])
print(nums_2d)
print("**")
pretty_print(nums_2d)

letters = [ "A","B","C","D","E"]
letters_2d=[letters,letters,letters] #not copy letters ,they are reference letter
pretty_print(letters_2d)
letters_2d[0][0]="F"
pretty_print(letters_2d)  #

letters2 = [ "A","B","C","D","E"]
letters2_2d=[copy(letters2),copy(letters2),copy(letters2)] #not copy letters ,they are reference letter
pretty_print(letters2_2d)
letters2_2d[0][0]="F"
pretty_print(letters2_2d)  #


这个不是特别明白

 

posted on 2017-10-19 17:23  uxiuxi  阅读(549)  评论(0)    收藏  举报