Full library done, should be no bugs (I hope)

This commit is contained in:
benjamyn committed 2018-03-29 04:48:27 +11:00
1 parent c0b7f38521
commit b64429ba5c
4 files changed
+21 -3

No files matched your search

+3
View File
@@ -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
Regular → Executable
+18 -2
View File
@@ -1,7 +1,23 @@
#!/usr/bin/python2 #!/usr/bin/python2
## Country Code Lookup Library ## Country Code Lookup Library
## Import the CSV file for the country codes ## 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
View File
Binary file not shown.
-1
View File
@@ -247,4 +247,3 @@ Western Sahara,EH
Yemen,YE Yemen,YE
Zambia,ZM Zambia,ZM
Zimbabwe,ZW Zimbabwe,ZW
1 Afghanistan AF
247 Yemen YE
248 Zambia ZM
249 Zimbabwe ZW