有没有一个Python函数可以规范化字符串文件路径或比较字符串文件路径?在
也就是像下面这样的函数(我自己编的):
norm_path = os.normalise("C:\\abc/def/hij\\")
print(norm_path) # c:\abc\def\hij
# I'm looking for a function that converts all "/" to "\\", converts to lowercase
# and removes trailing "\\" or "/" chars so I can compare strings
在我写我自己的函数之前,我想看看是否已经有一个函数可以做到这一点,所以我不会重新发明轮子。在
相关问题 更多 >
编程相关推荐