Published Jan 25 2021
The os.path.exists()
method provided by the os
standard library module returns True
if a file exists, and False
if not.
Here is how to use it:
import os
filename = '/Users/flavio/test.txt'
exists = os.path.exists(filename)
print(exists) # True
I wrote an entire book on this topic 👇
© 2023 Flavio Copes
using
Notion to Site
Interested in solopreneurship?