Wrote some absolutely atrocious code and Im kinda proud of it.
In a project I was working on I needed to take out a username from a facebook link. Say the input is: "https://www.facebook.com/some.username/" the output should be a string: "some.username". Whats funny is this is genuinely the first idea I came up with when faced with this problem.
Without further a do here is my code:
def get_username(url):
return url[::-1][1 : url[::-1].find("/", 1)][::-1]
I know.
its bad.