1import os.path
2from os import path
3
4def main():
5
6 print ("File exists:"+str(path.exists('guru99.txt')))
7 print ("File exists:" + str(path.exists('career.guru99.txt')))
8 print ("directory exists:" + str(path.exists('myDirectory')))
9
10if __name__== "__main__":
11 main()
1import os
2
3# check the if the path is a directory
4print(os.path.isdir("path"))
5
6# check if the path is a file
7print(os.path.isfile("path"))
8