37,720
社区成员
发帖
与我相关
我的任务
分享
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)
05.22+初雪+张三+824951512+58.5
05.21+春潮+李四+751524641+65.2
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)
最好是把里面的数据以代友的形式发