import os
print(os.path.isdir("/home/el"))
print(os.path.exists("/home/el/myfile.txt"))
>>> import os
>>> os.path.isdir('new_folder')
True
>>> os.path.exists(os.path.join(os.getcwd(), 'new_folder', 'file.txt'))
False
os.path.isdir("/home/el")
import os
os.path.isdir("/home/el") # Returns True if exist
os.path.exists("/home/el/myfile.txt") # Return False if not exist
>>> import os
>>> os.path.isdir('new_folder')
True
import os.path
from os import path
def main():
print ("File exists:"+str(path.exists('guru99.txt')))
print ("File exists:" + str(path.exists('career.guru99.txt')))
print ("directory exists:" + str(path.exists('myDirectory')))
if __name__== "__main__":
main()