一维列表,线性的数据。[10,20,30,40]
二维列表,表格的数据。例如:[[11,12],[21,22],30]
>>> a=[['tom','18','3000','shanghai'],['jack','19','20000','beijing'],] >>> a [['tom', '18', '3000', 'shanghai'], ['jack', '19', '20000', 'beijing']] >>> a[0] ['tom', '18', '3000', 'shanghai'] >>> a[0][0] 'tom' >>> |
示例:
a=[['tom','18','3000','shanghai'],['jack','19','20000','beijing']] for m in range(2): for n in range(3): print(a[m][n],end='\t') #制表符 print()#打印完一行,换行 |