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
pathvalidate-0.3.0.tar.gz
(906.1 kB
view hashes)
Built Distribution
Close
Hashes for pathvalidate-0.3.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58605b11845cc48e89b2619b9d665dcc631b446e2938b15ae9fab84c701470c2 |
|
MD5 | 607836ce4ed2dbf5fd85edb4bf133360 |
|
BLAKE2b-256 | 5da74af6bc0076307f396d2adeefa64dc9a08641ee5557e83a3e187bbc9b956c |