September 2018
Intermediate to advanced
426 pages
10h 46m
English
We can check whether a certain string is a file or directory. For this, we can use the os.path.isfile() method, which returns True if it is a file and False if it is a directory:
>>> import os >>> os.path.isfile("/") False >>> os.path.isfile("./main.py") True
Read now
Unlock full access