Full library done, should be no bugs (I hope)
This commit is contained in:
1 parent
c0b7f38521
commit
b64429ba5c
4 files changed
+21
-3
No files matched your search
@@ -0,0 +1,3 @@
|
||||
This is a quick library that I threw together to translate contry codes to there full name
|
||||
|
||||
This is only meant for internal projects so lol rip
|
||||
@@ -1,7 +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
|
||||
Reference in new issue
Block a user