Answers for "search a file in python"

1

file searching in python

with open('largeFile', 'r') as inF:
    for line in inF:
        if 'myString' in line:
            # do_something
Posted by: Guest on September-06-2021
0

find a file in python

import os

def find(name, path):
    for root, dirs, files in os.walk(path):
        if name in files:
            return os.path.join(root, name)
Posted by: Guest on December-16-2021

Code answers related to "search a file in python"

Python Answers by Framework

Browse Popular Code Answers by Language