pathvalidate is a python library to validate filename.
Project description
pathvalidate
Summary
pathvalidate is a python library to validate filename.
Installation
pip install pathvalidate
Usage
Filename validation
import pathvalidate
filename = "a*b:c<d>e%f(g)h.txt"
try:
pathvalidate.validate_filename(filename)
except ValueError:
print("invalid filename!")
invalid filename!
Replace invalid chars
import pathvalidate
filename = "a*b:c<d>e%f(g)h.txt"
print(pathvalidate.sanitize_filename(filename))
abcde%f(g)h+i.txt
Replace symbols
import pathvalidate
filename = "a*b:c<d>e%f(g)h.txt"
print(pathvalidate.replace_symbol(filename))
abcdefgh+itxt
Dependencies
Python 2.6+ or 3.3+
Test dependencies
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.1.0.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for pathvalidate-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b43aeeb461c849c77d4b24bc6736c078ea28daffd04404925e56689a4f3f0826 |
|
MD5 | b437951e916362a0b0e8820f358777b0 |
|
BLAKE2b-256 | e42ce6431b3e7f3c02acf338d83e7814b017fdb411608981bd1c475d2d06a430 |