Added Proper countries to the iplookup
This commit is contained in:
1 parent
2af820f565
commit
b41fc878fc
5 files changed
+283
-3
No files matched your search
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/python2
|
||||
|
||||
## Country Code Lookup Library
|
||||
## Import the CSV file for the country codes
|
||||
def openCSV(filename):
|
||||
try:
|
||||
CSVFile = open(filename)
|
||||
return CSVFile
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
def parseCSV(inputFile):
|
||||
codeDict = {}
|
||||
FileContents = inputFile.read()
|
||||
SepContents = FileContents.split('\n')
|
||||
#SepContents = FileContents.split(',')
|
||||
for entry in SepContents:
|
||||
testentry = entry.split(',')
|
||||
if len(testentry) == 2:
|
||||
codeDict[testentry[1]] = testentry[0]
|
||||
else:
|
||||
pass
|
||||
return codeDict
|
||||
BIN
Binary file not shown.
Reference in new issue
Block a user