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