被贴了 就转图片为文字儿吧:
<br / https://pypi.python.org/pypi/python-stdnum br />
<br /><br />...<br />>>> from stdnum.iso7064 import mod_11_2<br />>>> mod_11_2.calc_check_digit('44022919890604423')<br />'X'<br />>>> mod_11_2.validate('44022919890604423X')<br />'44022919890604423X'<br />>>> mod_11_2.validate('440229198906044234')<br />Traceback (most recent call last):<br /> File "<stdin>", line 1, in <module><br /> File "D:\Program Files\Python27\lib\site-packages\stdnum\iso7064\mod_11_2.py",<br /> line 65, in validate<br /> raise InvalidChecksum()<br />stdnum.exceptions.InvalidChecksum: The number's checksum or check digit is inval<br />id.<br />>>> mod_11_2.validate('440229198906044231')<br />Traceback (most recent call last):<br /> File "<stdin>", line 1, in <module><br /> File "D:\Program Files\Python27\lib\site-packages\stdnum\iso7064\mod_11_2.py",<br /> line 65, in validate<br /> raise InvalidChecksum()<br />stdnum.exceptions.InvalidChecksum: The number's checksum or check digit is inval<br />id.<br />>>> mod_11_2.validate('440229198906044236')<br />Traceback (most recent call last):<br /> File "<stdin>", line 1, in <module><br /> File "D:\Program Files\Python27\lib\site-packages\stdnum\iso7064\mod_11_2.py",<br /> line 65, in validate<br /> raise InvalidChecksum()<br />stdnum.exceptions.InvalidChecksum: The number's checksum or check digit is inval<br />id.<br />>>> mod_11_2.validate('44022919890605423X')<br />Traceback (most recent call last):<br /> File "<stdin>", line 1, in <module><br /> File "D:\Program Files\Python27\lib\site-packages\stdnum\iso7064\mod_11_2.py",<br /> line 65, in validate<br /> raise InvalidChecksum()<br />stdnum.exceptions.InvalidChecksum: The number's checksum or check digit is inval<br />id.<br />>>><br /><br />...<br />