windows、python3.9.7で
fileにパス付きファイル名が与えられた時に、パス無しファイル名(拡張子無し)と拡張子を取得する場合
if "." in os.path.basename(file):
____ext_without_dot = os.path.basename(file).split(".")[-1]
____basenaname_without_ext = os.path.basename(file).removesuffix("." + ext_without_dot)
else:
____ext_without_dot = ""
____basenaname_without_ext = os.path.basename(file)
で問題ないでしょうか?
もっと綺麗な書き方あったら教えてください。