|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
我是先将Excel中的数据导入到pyqt5的textEdit中,然后获取textEdit中的数据,数据如下:
41.246 51.405 61.411 67.356 70.777 72.594 73.182 72.839 71.804 70.421 68.808 67.275 65.717 64.148 62.786
41.706 52.227 61.794 66.676 68.981 69.638 68.968 67.278 64.929 62.261 59.461 56.894 54.543 52.353 50.427
40.459 50.125 58.268 61.953 63.294 63.056 61.502 58.955 55.846 52.577 49.329 46.473 43.933 41.683 39.719
38.596 47.184 53.972 56.745 57.475 56.683 54.625 51.665 48.274 44.862 41.628 38.862 36.437 34.353 32.569
36.774 44.636 50.223 52.259 52.406 51.112 48.714 45.546 42.012 38.543 35.356 32.688 30.364 28.402 26.704
35.218 42.056 46.643 48.017 47.727 46.141 43.581 40.316 36.780 33.347 30.279 27.732 25.546 23.719 22.128
33.284 39.318 43.111 44.095 43.558 41.786 39.132 35.862 32.379 29.112 26.194 23.779 21.733 20.041 18.571
31.090 36.632 39.720 40.371 39.591 37.704 35.039 31.814 28.431 25.306 22.550 20.290 18.375 16.804 15.443
现在我需要循环读取上面的数据,因为textEdit中的数据是str类型的,所以我先循环读取每行的数据,将每行的数据保存到一个列表中。代码如下:
for i in range(reflect_rows):
List = list[i]
list_change = List.split(' ')
获取的结果如下
['41.246', '51.405', '61.411', '67.356', '70.777', '72.594', '73.182', '72.839', '71.804', '70.421', '68.808', '67.275', '65.717', '64.148', '62.786']
['41.706', '52.227', '61.794', '66.676', '68.981', '69.638', '68.968', '67.278', '64.929', '62.261', '59.461', '56.894', '54.543', '52.353', '50.427']
['40.459', '50.125', '58.268', '61.953', '63.294', '63.056', '61.502', '58.955', '55.846', '52.577', '49.329', '46.473', '43.933', '41.683', '39.719']
['38.596', '47.184', '53.972', '56.745', '57.475', '56.683', '54.625', '51.665', '48.274', '44.862', '41.628', '38.862', '36.437', '34.353', '32.569']
['36.774', '44.636', '50.223', '52.259', '52.406', '51.112', '48.714', '45.546', '42.012', '38.543', '35.356', '32.688', '30.364', '28.402', '26.704']
['35.218', '42.056', '46.643', '48.017', '47.727', '46.141', '43.581', '40.316', '36.780', '33.347', '30.279', '27.732', '25.546', '23.719', '22.128']
['33.284', '39.318', '43.111', '44.095', '43.558', '41.786', '39.132', '35.862', '32.379', '29.112', '26.194', '23.779', '21.733', '20.041', '18.571']
['31.090', '36.632', '39.720', '40.371', '39.591', '37.704', '35.039', '31.814', '28.431', '25.306', '22.550', '20.290', '18.375', '16.804', '15.443',]
但是现在我还需要将每个数字再除以100,然后保存到列表中,我的想法是使用双重循环遍历每个列表中的每个元素,然后将每个数据除以100,然后再将结果保存到列表中
但是我在使用append将结果添加到列表中时发现添加的数据与我想要的不一样。
我想要的数据是在原数据的基础上除以100,还能保存成上面这样的列表,方便后面的计算使用。
希望大佬们能给提点建议,应该怎么弄,谢谢了
|
|