Oct-14-2019, 12:31 PM
(Oct-14-2019, 10:42 AM)snippsat Wrote: Can use in_place which make it easier the read/write to same place in one go.
import os import in_place for files in os.scandir('.'): if files.name.endswith('.LIC'): with in_place.InPlace(files) as f: text = f.read().replace('abcd', 'efgh') f.write(text)