Python Forum
Search file with *filename* python 3.8
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search file with *filename* python 3.8
#7
(Dec-20-2019, 10:08 PM)lastyle Wrote: for parsing the sub and subsub folders i need to switch to dirwalk, correct ?
If use an other walk name os.walk().
import os
import re

for root, dirs, files in os.walk('.'):
    for file in files:
        if re.match(r".*bestfile.*", file):
            print(file)
Reply


Messages In This Thread
Search file with *filename* python 3.8 - by lastyle - Dec-19-2019, 09:07 PM
RE: Search file with *filename* python 3.8 - by snippsat - Dec-21-2019, 12:10 AM

Forum Jump:

User Panel Messages

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