Python Forum
What Python skills for a fraud detective?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What Python skills for a fraud detective?
#2
(Mar-05-2022, 05:14 AM)MaartenRo Wrote: I already learned some basic Python skills. I would like to learn python skills for searching through a lot of files. What should i focus on? Should i use books or a online course?
For this should look into os module and pathlib(a more modern way).
To give example let say want to find a .txt file and that the search is recursively(all sub-folders) for this file.
from pathlib import Path

dest = r'C:\Test'
for path in Path(dest).rglob('*.txt'):
    if path.is_file():
        print(path)
The same with os.walk.
import os

dest = r'C:\Test'
for root, dirs, files in os.walk(dest):
    for file in files:
        if '.txt' in file:
            print(os.path.join(root, file))
I would say that looking most into pathlib(Taming the File System) is the way to go.
Also learn command line tools like find, grep, awk ...ect
Reply


Messages In This Thread
RE: What Python skills for a fraud detective? - by snippsat - Mar-05-2022, 04:05 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020