Although what Christophe suggested is a more Pythonic solution, the os module does have the os.access function to check access:
os.access('/path/to/folder', os.W_OK)
# W_OK is for writing, R_OK for reading, etc.
More Related Contents:
- How can I safely create a nested directory?
- Directory-tree listing in Python
- How come a file doesn’t get written until I stop the program?
- How can I safely create a directory (possibly including intermediate directories)?
- how to find the owner of a file or directory in python
- How can I extract the folder path from file path in Python?
- Find all CSV files in a directory using Python
- Creating files and directories via Python
- How do I create a directory, and any missing parent directories?
- What needs to be added
- How do I check whether a file exists without exceptions?
- How do I list all files of a directory?
- Flask raises TemplateNotFound error even though template file exists
- How do I check file size in Python?
- Getting a list of all subdirectories in the current directory
- Python convert csv to xlsx
- How to import a Python class that is in a directory above?
- What is the perfect counterpart in Python for “while not EOF”
- What is the return value of os.system() in Python?
- How do I check if directory exists in Python?
- Python list directory, subdirectory, and files
- What does ‘wb’ mean in this code, using Python?
- How to save a list to a file and read it as a list type?
- How do you read a file into a list in Python? [duplicate]
- How to delete the first line of a text file?
- Check if object is file-like in Python
- How to read one single line of csv data in Python?
- How to delete a specific line in a text file using Python?
- Given a path, how can I extract just the containing folder name?
- UTF-8 HTML and CSS files with BOM (and how to remove the BOM with Python)