Write a Python program to check whether a file path is a file or a directory.
1 2 3 4 5 6 7 8 9 |
import os path="abc.txt" if os.path.isdir(path): print("\nIt is a directory") elif os.path.isfile(path): print("\nIt is a normal file") else: print("It is a special file (socket, FIFO, device file)" ) print() |