import openpyxl from openpyxl import workbook import numpy as np path = "F:\chichi-TCU056\chichi-TCU056-E-A.xlsx" #原始的PEER文件路径 wb_1 = openpyxl.load_workbook(path) wb_names = wb_1.sheetnames sheet = wb_1[wb_names[0]] print(sheet.title) print(sheet.dimensions) acc = [] for i in range(5,sheet.max_row-1): for j in range(0, 5): b = sheet[i][j].value #给一个过渡用的单元值 acc.append(b) #将值存入acc列表中 #==================将整理好的列表导入新的工作簿中================== sht_changed = wb_1.create_sheet("changed") #新建一个工作表,保存整理好的数据列 for i in range(1,len(acc)): sht_changed.cell(i,2).value = acc[i-1] wb_1.save("F:\chichi-TCU056\chichi-TCU056-E-A-changed.xlsx") #保存已经修改后的工作簿
PEER地震动记录行列转换代码(python)
最新推荐文章于 2024-05-08 16:12:14 发布