码迷,mamicode.com
首页 > 编程语言 > 详细

Ansys采用后处理list Rusult输出位移时负号原因导致不能分列的python解决方法

时间:2021-05-24 00:13:27      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:imp   lines   change   rgb   open   输出   导致   import   com   

‘‘‘
! ========== Creat Date: 2021-5-4 ==========
! ========== Author: xdd1997        ==========
! ========== Email: xdd2026@qq.com  ==========
‘‘‘

import re
#  ================ 输入文件 ================ # 接口  filePath = ‘D:\\Desktop\\uu.lis‘  也可以
filePath = rD:\Desktop\PRNSOL.lis
pathAndName = filePath.split(".")[0]
fileOutPath = pathAndName + _change.txt
# ================ 获取文件行数 ================
count = -1
for count, line in enumerate(open(filePath)):
    pass
count += 1
file_line = count
print(file_line)
# ================处理文件 ==================
kk =0
with open(filePath, r) as old_file:
    with open(fileOutPath, w) as new_file:
        for line in old_file.readlines():
             kk = kk + 1
             if ((kk>11) and (kk<(file_line-4))):
                 new_file.writelines(line[1:9] +   +line[9:21] +   + line[21:33] +   + line[33:57]+\n)

 

Ansys采用后处理list Rusult输出位移时负号原因导致不能分列的python解决方法

标签:imp   lines   change   rgb   open   输出   导致   import   com   

原文地址:https://www.cnblogs.com/xdd1997/p/14729525.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!