1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
:Sample Code:
.. code-block:: python
from pathvalidate import sanitize_filename
fname = "fi:l*e/p\"a?t>h|.t<xt"
print(f"{fname} -> {sanitize_filename(fname)}\n")
fname = "\0_a*b:c<d>e%f/(g)h+i_0.txt"
print(f"{fname} -> {sanitize_filename(fname)}\n")
:Output:
.. code-block:: none
fi:l*e/p"a?t>h|.t<xt -> filepath.txt
_a*b:c<d>e%f/(g)h+i_0.txt -> _abcde%f(g)h+i_0.txt
The default target ``platform`` is ``universal``.
i.e. the sanitized file name is valid for any platform.
|