为什么这两种方法打印2d列表不同(python)

时间:2017-07-13 23:08:59

标签: python-3.x multidimensional-array

board = [[] for i in range(3)]
for i in board:
    for j in range(3):
        i.append(' ')

for i in board:print(i)
''' 
['', '', '']
['', '', '']
['', '', '']'''
print(i for i in board) #<generator object <genexpr> at 0x0000026E45CB69E8>

为什么最后两行打印两种不同的东西?

0 个答案:

没有答案