Skip to content

Instantly share code, notes, and snippets.

@fredj
Forked from twpayne/awb.py
Created October 25, 2012 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredj/3953427 to your computer and use it in GitHub Desktop.
Save fredj/3953427 to your computer and use it in GitHub Desktop.
AWB (Airway bill) number validation
import re
def valid(awb):
m = re.match('\d{3}(?P<serial>\d{7})(?P<check>\d)\Z', str(awb))
return int(m.group('serial')) % 7 == int(m.group('check')) if m else False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment