想要把txt文件里的數(shù)據(jù)導(dǎo)入xls中
1.讀取txt文件
open('fileroute')
2.讀取txt文件內(nèi)容也切,將想要的數(shù)據(jù)過(guò)濾出來(lái)
因?yàn)閿?shù)據(jù)是在某些固定值后面附井,使用for循環(huán)去獲取這些值,將數(shù)值存入list中
3.創(chuàng)建xls文件
import xlwt?
wb=Workbook()
ws=wb.add_sheet('sheetname')
3.使用pands
import pands as pd
df=pd.DataFrame(list,columnName)
df.to_execl('TextName')