コードでISBN(DIGIT)を確認すると:check_digit_13(2000003294107)
def check_digit_13(isbn):
assert len(isbn) == 12
sum = 0
for i in range(len(isbn)):
c = int(isbn[i])
if i % 2: w = 3
else: w = 1
sum += w * c
r = 10 - (sum % 10)
if r == 10: return '0'
else: return str(r)
エラー :
Traceback (most recent call last):
File "parser.py", line 16, in <module>
lk.run(document)
File "/data/www/crons/lk/parser.py", line 33, in run
field = lkmapper.all(row, document)
File "/data/www/crons/mappers/lk.py", line 5, in all
print isbn.check_digit_13(field[0])
File "/data/www/crons/libs/isbn.py", line 13, in check_digit_13
assert len(isbn) == 12
AssertionError