Skip to content

Instantly share code, notes, and snippets.

@brettcannon
Created July 11, 2014 17:34
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
import io
import sys
def read_file(path, data):
with io.open(path) as file:
for domain in file.readlines():
data.add(domain.strip().lower())
def write_file(data, path='whitelist.txt'):
with io.open(path, 'w') as file:
file.write('\n'.join(sorted(data)))
if __name__ == '__main__':
domains = set()
for path in sys.argv[1:]:
read_file(path, domains)
write_file(domains)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment