Skip to content

Instantly share code, notes, and snippets.

@j105rob
Created August 27, 2015 15:00
Show Gist options
  • Save j105rob/f9b3d87c10932857a0ee to your computer and use it in GitHub Desktop.
Save j105rob/f9b3d87c10932857a0ee to your computer and use it in GitHub Desktop.
for Da
s = "http://www.foo.com/bar/baz"
a = s.split('/')
a.reverse()
a.pop()
a.pop()
a.pop()
a.reverse()
out = "/"+"/".join(a)
print out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment