os.path.isdir()
and os.path.isfile()
should give you what you want. See:
http://docs.python.org/library/os.path.html
More Related Contents:
- How to make a dict from n’th indices of tuples in list
- Changing default encoding of Python?
- List comprehension with if statement
- How to add a new column to a CSV file?
- Python list doesn’t reflect variable change
- What do square brackets, “[]”, mean in function/class documentation?
- How to use Paramiko logging?
- Why is semicolon allowed in this Python snippet?
- Do I understand os.walk right?
- numpy: formal definition of “array_like” objects?
- How to plot one line in different colors
- How to do multiple arguments to map function where one remains the same
- PDF bleed detection
- What is the motivation for the “or” operator to not return a bool?
- Merging a list of time-range tuples that have overlapping time-ranges
- Unable to install Python packages using pip in Ubuntu Linux: InsecurePlatformWarning, SSLError, tlsv1 alert protocol version
- When import docx in python3.3 I have error ImportError: No module named ‘exceptions’
- Parse SGML with Open Arbitrary Tags in Python 3
- iterating over file object in Python does not work, but readlines() does but is inefficient
- Is it possible to assign the same value to multiple keys in a dict object at once?
- Kill or terminate subprocess when timeout?
- How can I extract tables from PDF documents?
- Reading a file using a relative path in a Python project
- Python – create an EXE that runs code as written, not as it was when compiled
- How to run stored procedure on SQL server from Spark (Databricks) JDBC python?
- Know the depth of a dictionary
- UTF-8 HTML and CSS files with BOM (and how to remove the BOM with Python)
- Which special methods bypasses __getattribute__ in Python?
- Django: sudden DB reset after Heroku sleep
- Python regular expression not matching