| author | ymh <ymh.work@gmail.com> |
| Tue, 26 Oct 2010 13:18:58 +0200 | |
| changeset 3 | 3b54cc07c7f7 |
| parent 1 | eb9188f2ee4f |
| permissions | -rw-r--r-- |
""" Some small file related utilities """ import unicodedata import string validFilenameChars = "-_.() %s%s" % (string.ascii_letters, string.digits) def sanitize_filename(filename): cleanedFilename = unicodedata.normalize('NFKD', filename).encode('ASCII', 'ignore').lower() return ''.join(c for c in cleanedFilename if c in validFilenameChars).replace(' ','_')