Skip to main content

pathvalidate is a python library to validate filename.

Project description

pathvalidate

https://img.shields.io/pypi/pyversions/pathvalidate.svg https://travis-ci.org/thombashi/pathvalidate.svg?branch=master https://coveralls.io/repos/github/thombashi/pathvalidate/badge.svg?branch=master

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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pathvalidate-0.1.0-py2.py3-none-any.whl (4.0 kB view details)

Uploaded Python 2Python 3

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

Hashes for pathvalidate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 267484f32585e2c109edea2255f5999c67a691b48a57b3c109fd1f9a09a63e36
MD5 ed679c284b2a9004880c58dcdc213bc3
BLAKE2b-256 b3f0c6740846aaa7bb2ddf41a2ed0a1dfb0b18d0c6e2123db8fb823732f898ee

See more details on using hashes here.

File details

Details for the file pathvalidate-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pathvalidate-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b43aeeb461c849c77d4b24bc6736c078ea28daffd04404925e56689a4f3f0826
MD5 b437951e916362a0b0e8820f358777b0
BLAKE2b-256 e42ce6431b3e7f3c02acf338d83e7814b017fdb411608981bd1c475d2d06a430

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page