nigsp.io.check_ext¶
- nigsp.io.check_ext(all_ext, fname, scan=False, remove=False)[source]¶
Check which extension a file has, and possibly remove it.
- Parameters:
- all_ext
list
All possible extensions to check within
- fname
str
oros.PathLike
The filename to check
- scan
bool
, optional Scan the given path to see if there is a file with that extension If True and no path declared, check if fname has a path, if not scan ‘.’ If False, don’t scan any folder
- remove
bool
, optional Remove the extension from fname if it has one
- all_ext
- Returns:
- obj_return
Uses
a
list
to
return
variable
amount
of options. - has_extboolean
True if the extension is found, false otherwise
- fnamestr or os.PathLike
If remove is True, return (extensionless) fname
- extstr
If both remove and has_ext are True, returns also found extension
- obj_return