Splits filename into tuple of (fileroot, extension, trailing_suffix, guessed_name)
Parameters : | filename : str
types_exts : sequence of sequences
trailing_suffixes : sequence of strings
match_case : bool, optional
|
---|---|
Returns : | pth : str
ext : str
trailing : str
guessed_type : str
|
Examples
>>> types_exts = (('t1', 'ext1'),('t2', 'ext2'))
>>> parse_filename('/path/fname.funny', types_exts, ())
('/path/fname', '.funny', None, None)
>>> parse_filename('/path/fnameext2', types_exts, ())
('/path/fname', 'ext2', None, 't2')
>>> parse_filename('/path/fnameext2', types_exts, ('.gz',))
('/path/fname', 'ext2', None, 't2')
>>> parse_filename('/path/fnameext2.gz', types_exts, ('.gz',))
('/path/fname', 'ext2', '.gz', 't2')