All pastes #986386 Raw Edit

python script

public text v1 · immutable
·published 2008-04-15 19:38 UTC
rendered paste body
#!/usr/bin/env python

# grab our list
input_file = open("blocklist.txt","r")

# create an empty dictionary
RO_DICT = {}

# start iterating through the list, building the dictionary
for item in input_file:
    fullString = item.split(" ")
    domainName = fullString[0]
    ip = fullString[1]
    mylist = []
    if (domainName in RO_DICT):
        sublist = []
        sublist = RO_DICT[domainName]
        sublist.append('ip')
        RO_DICT[domainName] = sublist
    else:
        RO_DICT[domainName] = "ip"

print RO_DICT.items()