Created
August 22, 2017 09:25
-
-
Save nooperpudd/4051471dffaf8634f0d3d958c3443fdc to your computer and use it in GitHub Desktop.
Sort domain
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 sort_by_domain(sites): | |
sitebits = [site.lower().lstrip('http://').split('.') for site in sites] | |
for site in sitebits: | |
site.reverse() | |
print(sitebits) | |
return [('.'.join(reversed(site))) for site in sorted(sitebits)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
input:
result: