Last active
October 13, 2015 23:58
-
-
Save georgespingos/4276659 to your computer and use it in GitHub Desktop.
Validate Greek IBAN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
def VAlidateIBAN_GR(IBAN): | |
if len(IBAN) != 27 or IBAN[0].isalpha() == False or IBAN[1].isalpha() == False or IBAN[2:].isdigit() == False: | |
return False; | |
alph={}; | |
i=10; | |
for x in string.ascii_uppercase: | |
alph[x]=i | |
i = i+1 | |
decIBAN = int(IBAN[4:]+str(alph[IBAN[0]]) + str(alph[IBAN[1]]) + IBAN[2] + IBAN[3]) % 97 | |
if decIBAN == 1: | |
return True | |
else: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment