The simplest way to do this would be using pathlib . ... import os path = "C:/example/folder/file1.jpg" print(os.path.basename(os.path.dirname(path))).
確定! 回上一頁