Skip to content

Instantly share code, notes, and snippets.

@Jojozzc
Created January 8, 2019 09:21
Show Gist options
  • Save Jojozzc/fb702d98493d7e2ceea7d40e894d4b6b to your computer and use it in GitHub Desktop.
Save Jojozzc/fb702d98493d7e2ceea7d40e894d4b6b to your computer and use it in GitHub Desktop.
convert path to unix-like path
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