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 details)
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.1.0.tar.gz.
File metadata
- Download URL: pathvalidate-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
267484f32585e2c109edea2255f5999c67a691b48a57b3c109fd1f9a09a63e36
|
|
| MD5 |
ed679c284b2a9004880c58dcdc213bc3
|
|
| BLAKE2b-256 |
b3f0c6740846aaa7bb2ddf41a2ed0a1dfb0b18d0c6e2123db8fb823732f898ee
|
File details
Details for the file pathvalidate-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: pathvalidate-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b43aeeb461c849c77d4b24bc6736c078ea28daffd04404925e56689a4f3f0826
|
|
| MD5 |
b437951e916362a0b0e8820f358777b0
|
|
| BLAKE2b-256 |
e42ce6431b3e7f3c02acf338d83e7814b017fdb411608981bd1c475d2d06a430
|