this actually came up fairly recently on this very list -- go poke around
in the archives to find it.

But the short version is that there is no clear definition of a "sanitized"
filename -- see that SO thread to get the idea. So you really want a
solution that works for your use case, so not really a candidate for the
standard library.

There are a number of packages on PyPi that might help:

https://pypi.org/project/pathvalidate/

https://pypi.org/project/awesome-slugify/

just to name two.

-CHB


On Tue, Aug 11, 2020 at 10:51 PM Charles Machalow <[email protected]>
wrote:

> I was reading
> https://stackoverflow.com/questions/7406102/create-sane-safe-filename-from-any-unsafe-string
> and was thinking that functionality to create safe paths from unsafe paths
> and check if a Path would work on a given filesystem would well in Pathlib.
> _______________________________________________
> Python-ideas mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/5BVZGNLG6EHVC4APG7Z2L56VLSUJRXJX/
> Code of Conduct: http://python.org/psf/codeofconduct/
>


-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/SP7TZSOQVEERHSVN3T2Z7R3OYP6RR3MA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to