replace_ext

bidsaid.io.replace_ext(filename, new_ext)[source]

Replaces extension of a filename.

Parameters

filenamestr or Path

The path to the file.

new_extstr

The new extension.

Returns

Path

Filename with new extension.

Example

>>> replace_ext("file.nii.gz", ".json")
    "file.json"