栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

txt写进python

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

txt写进python

import sys
import random
import time
import xlwt
import codecs
 
def Txt_to_Excel(wb,inputTxt,start_row,start_col):
    fr = codecs.open(inputTxt,'r')
    line_number = 0
    row_excel = start_row
    for line in fr:
        line =line.split()
        col_excel =start_col;
        wb.write(row_excel,col_excel,line)
        line_number +=1
        row_excel +=1
 
 
if __name__ == '__main__':
    wb = xlwt.Workbook(encoding = 'utf-8')
    ws1 = wb.add_sheet("AppThroughput")
    startrow =0
    dir1 = './Indicator/AppThroughput/AppThroughput-ECMP-X1--0.4-50.0ms.txt'
    startcol1 =0
    Txt_to_Excel(ws1,dir1,startrow,startcol1)
    wb.save('excel_result1.xlsx')
————————————————
版权声明:本文为CSDN博主「一只积极向上的小咸鱼」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/m0_49448331/article/details/118711282

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/581094.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号