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.2.0.tar.gz
(886.2 kB
view hashes)
Built Distribution
Close
Hashes for pathvalidate-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93a2c998ebea9a177df0bd4b41baff6ade34bf313cd8cf7ad994015e63e63057 |
|
MD5 | 340db3395428be796ad0c4c5c1367dc0 |
|
BLAKE2b-256 | 0950843dfae240ee8afa74d6af7e992105d52264ee0eba18086a9b813e0bd74b |