-
-
Save twpayne/3952828 to your computer and use it in GitHub Desktop.
AWB (Airway bill) number validation
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 re | |
def valid(awb): | |
m = re.match('\d{3}(?P<serial>\d{7})(?P<check>\d)\Z', awb) | |
return m and int(m.group('serial')) % 7 == int(m.group('check')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
valid(42)
throws aTypeError: expected string or buffer