How to chech if a file exists? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to chech if a file exists?

How can I check if a filename exists before creating a new one?

4th Aug 2020, 8:34 PM
...
... - avatar
2 Answers
+ 9
os.path.exists('yourpath')
4th Aug 2020, 8:41 PM
HonFu
HonFu - avatar
+ 1
Thanks man
7th Aug 2020, 9:56 PM
...
... - avatar