pathvalidate is a python library to validate/sanitize a string such as filename/variable-name.
Project description
pathvalidate
Summary
pathvalidate is a python library to validate/sanitize a string such as filename/variable-name.
Examples
Filename validation
import pathvalidate
filename = "a*b:c<d>e%f(g)h+i_0.txt"
try:
pathvalidate.validate_filename(filename)
except ValueError:
print("invalid filename!")
invalid filename!
Sanitize a file path
import pathvalidate
filename = "a*b:c<d>e%f(g)h+i_0.txt"
print(pathvalidate.sanitize_filename(filename))
abcde%f(g)h+i_0.txt
For more information
More examples are available at http://pathvalidate.readthedocs.org/en/latest/pages/examples/index.html
Installation
pip install pathvalidate
Dependencies
Python 2.6+ or 3.3+
Test dependencies
Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pathvalidate-0.2.0.tar.gz.
File metadata
- Download URL: pathvalidate-0.2.0.tar.gz
- Upload date:
- Size: 886.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9dd6993c32aa4a02b8e226b9694e8eb6f6f9df63e145f731346048d754be706
|
|
| MD5 |
164d51c0b40a0a7c333e49722fc52557
|
|
| BLAKE2b-256 |
0e108b050edde46970d887c8464d11f2c056cec0dc7e918ce5ac4550c21e8b75
|
File details
Details for the file pathvalidate-0.2.0-py2.py3-none-any.whl.
File metadata
- Download URL: pathvalidate-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93a2c998ebea9a177df0bd4b41baff6ade34bf313cd8cf7ad994015e63e63057
|
|
| MD5 |
340db3395428be796ad0c4c5c1367dc0
|
|
| BLAKE2b-256 |
0950843dfae240ee8afa74d6af7e992105d52264ee0eba18086a9b813e0bd74b
|