Home > other >  Ask for help. Bat script
Ask for help. Bat script

Time:09-17

A batch of existing data stored in a TXT format, as shown in the figure need to be processed to generate excel files, format, as shown in the figure have bosses help

CodePudding user response:

 import pandas as pd 

F1=open (' test1. TXT ', 'r')
The texts=f1. Readlines ()
data=https://bbs.csdn.net/topics/pd.DataFrame ()
For the text in texts:
Ss=text. The split (" + ")
Tempdict={}
Tempdict [' date ']=ss [0]
Tempdict [' member name ']=ss [1]
Tempdict [' name ']=ss [2]
Tempdict [' id ']=ss [3]
Tempdict [' amount ']="". Join (ss [4]. The split ())
Print (tempdict)
data=https://bbs.csdn.net/topics/data.append (tempdict, ignore_index=True)
Data. To_excel (test1. XLSX, index=False)


The inside of the best is to put the data in the form of a generation of friends

CodePudding user response:

First snow
 05.22 + + zhang SAN + 824951512 + 58.5 
05.21 + spring tides occur, li si + 751524641 + 65.2

CodePudding user response:

 sstotal=[] 
For the text in texts:
Ss=[" "join (x.s plit ()) for x in the text. The split (" +") "
Sstotal. Append (ss)
data=https://bbs.csdn.net/topics/pd.DataFrame (sstotal, columns=[' date ', 'member name', 'name', 'number', 'amount'])
Data. To_excel (" test2. XLSX, "index=False)

CodePudding user response:

Python can read

CodePudding user response:

Newborn
reference 4 floor response:
python can read
python now I'm still learning, still can't do

CodePudding user response:

Appears to be the host to send the wrong section
  • Related