![Mastering Python for Networking and Security](https://wfqqreader-1252317822.image.myqcloud.com/cover/385/36699385/b_36699385.jpg)
上QQ阅读APP看书,第一时间看更新
Checking whether a file or directory exists
If you want to check whether a file exists in the current working path directory, you can use the os.path.exists() function, passing the file or directory you want to check as the parameter:
>>> import os
>>> os.path.exists("./main.py")
True
>>> os.path.exists("./not_exists.py")
False