Answers for "python re search in whole file"

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
-1

python : search file for string

import mmap

with open('example.txt') as f:
    s = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
    if s.find('blabla') != -1:
        print('true')
Posted by: Guest on September-25-2021

Python Answers by Framework

Browse Popular Code Answers by Language