import os
def get_immediate_subdirectories(a_dir):
return [name for name in os.listdir(a_dir)
if os.path.isdir(os.path.join(a_dir, name))]
More Related Contents:
- Turn the whole file uppercase
- Is explicitly closing files important?
- Iterating on a file doesn’t work the second time
- Directory-tree listing in Python
- How to write to a CSV line by line?
- Open file in a relative location in Python
- check what files are open in Python
- How to convert a file to utf-8 in Python?
- How do I append to a file?
- Read from a log file as it’s being written using python
- Is close() necessary when using iterator on a Python file object [duplicate]
- Finding duplicate files and removing them
- Compare two files report difference in python
- os.walk without digging into directories below
- Reading files in a particular order in python
- Python Random Access File
- Best method for reading newline delimited files and discarding the newlines?
- How to safely write to a file?
- What is the idiomatic way to iterate over a binary file?
- Read from File, or STDIN
- Detect duplicate MP3 files with different bitrates and/or different ID3 tags?
- Error with double backslash in Windows path in Python [duplicate]
- Sending a file over TCP sockets in Python
- Is there a way to efficiently yield every file in a directory containing millions of files?
- Determining Whether a Directory is Writeable
- Find all CSV files in a directory using Python
- How do I create a file in python without overwriting an existing file
- Python not able to open file with non-english characters in path
- Reading a File Line by Line in Python [duplicate]
- Writing to a new file if it doesn’t exist, and appending to a file if it does