Skip to content

Instantly share code, notes, and snippets.

@h3nryza
Created July 18, 2018 08:31
Show Gist options
  • Save h3nryza/111fca89c66b64b87696f61df66b73f4 to your computer and use it in GitHub Desktop.
Save h3nryza/111fca89c66b64b87696f61df66b73f4 to your computer and use it in GitHub Desktop.
Python check for training slash on a folder, add if missing
def trailingBackSlash(location):
if location[-1:] != "/" and "/" in location:
location = location + "/"
elif location[-1:] != "\\" "\\" in location:
location = location + "\\"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment