Last active
September 14, 2018 13:47
-
-
Save felix021/53466550950223a778b1254917d36592 to your computer and use it in GitHub Desktop.
中国身份证号校验码计算
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
def IdNumChecksum(id_num): | |
return '10X98765432'[sum([int(num) * (2 ** (17 - idx) % 11) for idx, num in enumerate(id_num[:17])]) % 11] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment