Python Forum
python print all files which contain specific word in it
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python print all files which contain specific word in it
#1
Hi Team,

how to print all files which contains specific word in files.
how to concat source path and word to search for.


import glob
SOURCE_PATH = r"E:\data\src"

with open(r'E:\data\mobile_list.csv','r') as f:
    reader = csv.reader(f)
    header = next(reader)
    for m in reader:
        files = glob.glob(SOURCE_PATH+r'\'+ f'*{m}*')
Reply


Messages In This Thread
python print all files which contain specific word in it - by mg24 - Jan-25-2023, 04:30 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help replacing word in Mutiple files. (SOLVED) mm309d 0 940 Mar-21-2023, 03:43 AM
Last Post: mm309d
  python move specific files from source to destination including duplicates mg24 3 1,194 Jan-21-2023, 04:21 AM
Last Post: deanhystad
  Failing to print sorted files tester_V 4 1,412 Nov-12-2022, 06:49 PM
Last Post: tester_V
  delete all files which contains word sql_Table1 mg24 2 943 Sep-15-2022, 10:05 PM
Last Post: mg24
  [GoogleTrans] How can i print my translation word ?... JamieVanCadsand 7 11,943 Aug-29-2021, 12:01 PM
Last Post: Melcu54
Question Problem: Check if a list contains a word and then continue with the next word Mangono 2 2,629 Aug-12-2021, 04:25 PM
Last Post: palladium
  Moving specific files then unzipping/decompressing christophereccles 2 2,442 Apr-24-2021, 04:25 AM
Last Post: ndc85430
  How to make a telegram bot respond to the specific word in a sentence? Metodolog 2 6,497 Dec-22-2020, 07:30 AM
Last Post: martabassof
  Searching for specific word in text files. JellyCreeper6 1 1,807 Nov-03-2020, 01:52 PM
Last Post: DeaD_EyE
  Find specific subdir, open files and find specific lines that are missing from a file tester_V 8 3,838 Aug-25-2020, 01:52 AM
Last Post: tester_V

Forum Jump:

User Panel Messages

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