sanitize_filename#

sanitize_filename(filename, ext, exclude_ext=False)[source]#

Returns a sanitized string in the form of name.extension

Parameters:
  • filename (str) – Unsanitized filename, could be ‘test.vtk’ or just ‘test’

  • ext (str) – Extension of the file, could be ‘vtk’

  • exclude_ext (bool) – If True, the returned string doesn’t have the extension

Returns:

sanitized – Sanitized filename in form of name.extension

Return type:

str