Created
January 5, 2014 23:47
-
-
Save hrbrmstr/8275775 to your computer and use it in GitHub Desktop.
script to process a file of hosts/domains into just TLDs using tldextract
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
#!/usr/bin/python | |
import tldextract | |
f = open("/tmp/indomains.txt") | |
hosts = f.readlines() | |
f.close() | |
tlds = ['.'.join(tldextract.extract(host.rstrip())[-2 : ]) for host in hosts] | |
f = open("/tmp/outdomains.txt","w") | |
f.writelines( "%s\n" % tld for tld in tlds ) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment