From b64429ba5c2cd682d59826a8d221f00668a79e3e Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Thu, 29 Mar 2018 04:48:27 +1100 Subject: [PATCH] Full library done, should be no bugs (I hope) --- README.md | 3 +++ cc.py | 20 ++++++++++++++++++-- cc.pyc | Bin 0 -> 660 bytes codes.csv | 1 - 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 README.md mode change 100644 => 100755 cc.py create mode 100644 cc.pyc 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 0000000000000000000000000000000000000000..b91e68ffc69b86a8f74d710d62c372a2e45a6649 GIT binary patch literal 660 zcmZuuOKRLu5UhUE_%pF_Fo}t8phfT|+aUyI@>zLdfo%*~4AKk89!rW|8$6&{C1=Sc za*JFg7f5wG*jYsAmHJ1it6uhdfBNIs&#MZ5AK~{MPdXyhz<1z^fp{RO1Ii*}tFl20 zCOmVV^oFp00R=|jn_wdt1?5Hi3b_hyrWj5jn*bRDK7MKim*g)CBRVYtQFB7q$5wY4 zyuYtvuT9tb|8$3?FU=~p%iE~iOy=eJ2j-*(VnKjIvW2SZq+k1#(Q(p>X=+1~$)4=U zfw+P#Rvs0sm^ARkfoqCj9Kda_DO_ArhWiD^42#b*Y;ugb_k#B(P)<)Qt~1;O427k2 zj$;~O(FDh{uLbyCm^Fp{{WO_?smplXm