from pathlib import Path def rename_duplicate(filepath: Path, i: int) -> Path: """Get file name with no duplicate. Args: filepath: Path to a file. i: Counter. """ _path = path if i == 0 else path.parent / f"{path.stem}({i}){path.suffix}" if _path.exists(): return rename_duplicate(path, i + 1) return _path
3/2 -> 1
3/2 -> 1.5
help(関数名)
astropy documentation
end
last