Created
March 20, 2016 08:05
-
-
Save Lvl4Sword/6073bde7c7e901c2495b to your computer and use it in GitHub Desktop.
HOSTS file creation
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
# this is a fairly basic script that i use to create a sorted HOSTS file | |
# copy whatever is printed out, and you have a HOSTS file :-) | |
a = [] | |
b = [] | |
with open('/home/user/hosts.txt', 'r') as infile: | |
for each in infile: | |
a.append(each.replace('\n','')) | |
a = sorted(a) | |
for each in a: | |
if each not in b: | |
b.append('127.0.0.1 ' + each) | |
for each in b: | |
print(each) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment