Home > other >  Climb to the top of the python multiple TXT file content
Climb to the top of the python multiple TXT file content

Time:10-13

Want to write a script in python, the realization of digital extracted from multiple TXT file, for example, 7652, 6453, 5767, 32022311223344 this kind of appearance, save the TXT file name + files extracted number, save to excel, thank you

CodePudding user response:

Knowledge:
1. Open the file
 
With the open (filename, 'w', encoding="utf-8") as f:
data=https://bbs.csdn.net/topics/f.readlines ()

2. Use a regular in the text extraction number
3. Use the CSV module written to CSV file inside the
4. Don't be lazy, write their own

CodePudding user response:

Extraction with positive side expression quickly, save to have trouble

CodePudding user response:

reference 1st floor cool_soup29 response:
knowledge:
1. Open the file
 
With the open (filename, 'w', encoding="utf-8") as f:
data=https://bbs.csdn.net/topics/f.readlines ()

2. Use a regular in the text extraction number
3. Use the CSV module written to CSV file inside the
4. Don't be lazy, write their own

If I would write need not ask bosses, I'm in biological, self-study before python forgot, particularly large amount of data recently, want to programmatically quickly handle

CodePudding user response:

reference weixin_40348669 reply: 3/f
Quote: refer to 1st floor cool_soup29 response:
knowledge:
1. Open the file
 
With the open (filename, 'w', encoding="utf-8") as f:
data=https://bbs.csdn.net/topics/f.readlines ()

2. Use a regular in the text extraction number
3. Use the CSV module written to CSV file inside the
4. Don't be lazy, write their own

If I would write need not ask bosses, I'm in biological, self-study before python forgot, particularly large amount of data recently, want to programmatically quickly handle


So, this two days I didn't what empty cough up, see if there are any reason person help you go through luo, gl

CodePudding user response:

reference 4 floor cool_soup29 response:
Quote: reference weixin_40348669 reply: 3/f

Quote: refer to 1st floor cool_soup29 response:
knowledge:
1. Open the file
 
With the open (filename, 'w', encoding="utf-8") as f:
data=https://bbs.csdn.net/topics/f.readlines ()

2. Use a regular in the text extraction number
3. Use the CSV module written to CSV file inside the
4. Don't be lazy, write their own

If I would write need not ask bosses, I'm in biological, self-study before python forgot, particularly large amount of data recently, want to programmatically quickly handle


So, this two days I didn't what empty cough up, see if there are any reason person help you go through luo, gl



Haha, correct the code written on the wrong one parameter, w to r
 
With the open (filename, the 'r', encoding="utf-8") as f:
data=https://bbs.csdn.net/topics/f.readlines ()

CodePudding user response:

With re match, read the file read one line, re. Find (\ d +? "" TXT),

CodePudding user response:

Suddenly do not just give me a direct messages send a WeChat ID, help you write a, can't see you don't know how to write the data format is side expression, the platform and not convenient

CodePudding user response:

Use for comprehension
  • Related