求助.bat脚本

m0_48050902 2020-05-22 11:31:10
现有一批数据存放于一个txt中,格式如图所示,需要处理生成excel文件,格式如图所示,有没有大佬帮帮忙
...全文
123 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_45903952 2020-05-24
  • 打赏
  • 举报
回复
看来是楼主发错版块了
m0_48050902 2020-05-23
  • 打赏
  • 举报
回复
引用 4 楼 文仁 的回复:
python可以读取
python目前我还在学习,暂时还做不到
Pandas PY 2020-05-23
  • 打赏
  • 举报
回复
python可以读取
weixin_45903952 2020-05-23
  • 打赏
  • 举报
回复
sstotal=[]
for text in texts:
	ss=["".join(x.split()) for x  in text.split("+") ]
	sstotal.append(ss)
data=pd.DataFrame(sstotal,columns=['日期','会员名','姓名','编号','金额'])
data.to_excel("test2.xlsx",index=False)
weixin_45903952 2020-05-23
  • 打赏
  • 举报
回复
05.22+初雪+张三+824951512+58.5
05.21+春潮+李四+751524641+65.2
weixin_45903952 2020-05-23
  • 打赏
  • 举报
回复
import pandas as pd

f1=open('test1.txt','r')
texts=f1.readlines()
data=pd.DataFrame()
for text in texts:
	ss=text.split("+")
	tempdict={}
	tempdict['日期']=ss[0]
	tempdict['会员名']=ss[1]
	tempdict['姓名']=ss[2]
	tempdict['编号']=ss[3]
	tempdict['金额']="".join(ss[4].split())
	print(tempdict)
	data=data.append(tempdict,ignore_index=True)
data.to_excel("test1.xlsx",index=False)
最好是把里面的数据以代友的形式发

37,720

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧