# -*- coding: utf-8 -*
import os, os.path, sys
from sys import path
#import matplotlib.pyplot as plt
from odbAccess import *
path.append('D:\\Anaconda\\Lib\\site-packages')
import xlwt
def Write_excel_file(filepath,filename,data):
workbook = xlwt.Workbook(encoding = 'utf-8')
worksheet = workbook.add_sheet('sheet1')
# Some data we want to write to the worksheet.
# 想写入工作表的数据
expenses = data
# Start from the first cell. Rows and columns are zero indexed.
# 从第一个单元格开始,行和列的索引均为 0
row = 0
col = 0
# Iterate over the data and write it out row by row.
# 迭代数据并逐行写入
for item, cost in (expenses):
worksheet.write(row, col, item)
worksheet.write(row, col + 1, cost)
row += 1
# 保存
workbook.save(filepath+filename+'.xls')#必须是这个格式
.
.
.
filepath = 'F:\\BaiduNetdiskWorkspace\\abaqus-python\\'
filename = 'xxx'
PoreData = zip(times,Pore_p)
Write_excel_file(filepath,filename,PoreData)
PS:
1、要确保自己python库有xlwt包
2、提取应力的代码没有给出,网上很多