sciris.sc_fileio.sanitizefilename

sanitizefilename(rawfilename)[source]

Takes a potentially Linux- and Windows-unfriendly candidate file name, and returns a “sanitized” version that is more usable.

Example:

bad_name = 'How*is*this*even*a*filename?!.doc'
good_name = sc.sanitizefilename(bad_name) # Returns 'How_is_this_even_a_filename.doc'