python 列表推导式,双重for循环 my_list = [ [[1, 2, 3], [4, 5, 6]] ] flat = [x for sub1 in my_list for sub2 in sub1 for x in sub2] print(flat) # [1, 2, 3, 4, 5, 6] flat2 = [((x for x in sub2) for sub2 in sub1) for sub1 in my_list] print(list(...
len1=input('这里可以自动生成双层列表,请输入外层列表的元素个数(任意自然数):') len2=input('这里可以自动生成双层列表,请输入内层列表的元素个数(任意自然数):') #想象上面输入的len1为7,len2为4,即以上面的table变量作为为下面循环的心中原型: print('[',end='') for i in range(0,int(len1)):...