Skip to content

Instantly share code, notes, and snippets.

@georgespingos
Last active October 13, 2015 23:58
Show Gist options
  • Save georgespingos/4276659 to your computer and use it in GitHub Desktop.
Save georgespingos/4276659 to your computer and use it in GitHub Desktop.
Validate Greek IBAN
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