utils.rm_suffix#

Back to Module page

Summary#

Utility to change the extension of a path

Signature#

def rm_suffix(filepath, suffix = '.json', new_suffix = None)
Input variables#

Name

Type

Default

Description

filepath

String or an instance of pathlib.PosixPath

suffix

‘.json’

Suffix to remove. Pass ‘.\*’ to remove any existing extension

new_suffix

None

Suffix to add, if desired

Output variables#

Return annotation

Docstring type

Description

None

Docstring#

Utility to change the extension of a path
:param filepath: String or an instance of pathlib.PosixPath
:param suffix: Suffix to remove. Pass '.*' to remove any existing extension
:param new_suffix: Suffix to add, if desired
:return: