diff --git a/README.md b/README.md new file mode 100644 index 0000000..1884b4d --- /dev/null +++ b/README.md @@ -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 diff --git a/cc.py b/cc.py old mode 100644 new mode 100755 index 6c4a180..4c5f021 --- a/cc.py +++ b/cc.py @@ -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 diff --git a/cc.pyc b/cc.pyc new file mode 100644 index 0000000..b91e68f Binary files /dev/null and b/cc.pyc differ diff --git a/codes.csv b/codes.csv index dc5da98..a8924ea 100644 --- a/codes.csv +++ b/codes.csv @@ -247,4 +247,3 @@ Western Sahara,EH Yemen,YE Zambia,ZM Zimbabwe,ZW -