# 将windows路径中的分隔符\转换为unix(linux)的分隔符/
@staticmethod
def transform_separator(windows_path):
linux_path = ''
if windows_path != '':
path_list = windows_path.split('\\')
linux_path = '/'.join(path_list)
else:
print("it is null")
return linux_path
参考了https://blog.csdn.net/talk_8/article/details/82055852
并将代码封装为静态方法。