Created
January 8, 2019 09:21
-
-
Save Jojozzc/fb702d98493d7e2ceea7d40e894d4b6b to your computer and use it in GitHub Desktop.
convert path to unix-like path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cvt_unix_like_path(path): | |
if path is None: | |
return None | |
path = str(path) | |
unix_p_temp = path.replace('\\', '/') | |
unix_p = '' | |
pre = '' | |
for ch in unix_p_temp: | |
if not (ch == '/'): | |
unix_p = unix_p + ch | |
elif not (pre == '/'): | |
unix_p = unix_p + ch | |
pre = ch | |
return unix_p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment