Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (45.3k points)

Possible Duplicate:

How to identify whether a file is normal file or directory using python

How do you check if a path is a directory or file in python?

1 Answer

0 votes
by (16.8k points)

os.path.isfile("bob.txt") # Does bob.txt exist?  Is it a file, or a directory?

os.path.isdir("bob")

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 2, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer

Browse Categories

...