1 [['峨眉山A', '峨眉山A', '峨眉山A', '峨眉山A', '峨眉山A'], ['000888', '000888', '000888', '000888', '000888'], ['2018-03-30', '2018-03-29', '2018-03-28', '2018-03-27', '2018-03-26'], ['9.90', '9.68', '9.41', '9.38', '9.30'], ['9.93', '9.97', '9.88', '9.48', '9.36'], ['9.75', '9.65', '9.37', '9.36', '9.11'], ['9.80', '9.85', '9.74', '9.44', '9.32'], ['-0.05', '0.11', '0.30', '0.12', '-0.05'], ['-0.51', '1.13', '3.18', '1.29', '-0.53'], ['64,115', '71,004', '87,800', '41,273', '34,705'], ['6,295', '6,972', '8,514', '3,890', '3,210'], ['1.83', '3.29', '5.40', '1.29', '2.67'], ['1.22', '1.35', '1.67', '0.78', '0.66']]
数据是上面的,怎么循环成这种:
1 ['***','***','2018-07-30','9','20','8','8.9','-0.2','-0.2','85555','8.9','-0.2','1.5'] 2 ['***','***','2018-07-30','9','20','8','8.9','-0.2','-0.2','85555','8.9','-0.2','1.5'] 3 ['***','***','2018-07-30','9','20','8','8.9','-0.2','-0.2','85555','8.9','-0.2','1.5'] 4 ['***','***','2018-07-30','9','20','8','8.9','-0.2','-0.2','85555','8.9','-0.2','1.5']
尝试了几种for循环,,都没达到效果。
外层循环5次(子数组长度).内层循环外数组长度.
外层循环new 目标数组长度, 内层循环从外数组的每一行中取外层循环I位置的数据插入目标数组.
实际上子数组有13个...刚试了循环差不多10次的时候,编译器就提示了xxx
@会发光: 你是不是把子数组的长度和子数组的个数.搞混了?
@吴瑞祥: sry 我理解错了,但是子数组的长度更多...平均在60左右
@吴瑞祥: 我一开始的想法是,先把子数组都循环出来,然后再把每个子数组循环出来,组合成list,试了一下,貌似for循环层数太多了...
@会发光: 正确的思路是:外层循环为结果行数.
内层循环为结果列数.你照着这个思路走就行了.
@吴瑞祥: 结果行数,是1行,结果列数,是13列
我试下
@会发光: 怎么会是1行..有多少个000888就有多少行吧?
@吴瑞祥: 那得多少循环呀...有点晕
@会发光: ```````循环次数啊 ...不是让你写多少个循环..
循环就2个.一个外层一个内层..
@吴瑞祥: 不懂...(╥﹏╥)
@吴瑞祥: 经过指导,用了矩阵转置,感谢*^_^*
@会发光: 你用矩阵怎么转的,分享下.