Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
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)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94k users

Browse Categories

...