You've already forked amazing-qr
mirror of
https://github.com/x-hw/amazing-qr.git
synced 2025-07-15 01:24:37 +02:00
fixed another bug about number encoding
This commit is contained in:
@ -65,13 +65,12 @@ def numeric_encoding(str):
|
|||||||
str_list = [str[i:i+3] for i in range(0,len(str),3)]
|
str_list = [str[i:i+3] for i in range(0,len(str),3)]
|
||||||
code = ''
|
code = ''
|
||||||
for i in str_list:
|
for i in str_list:
|
||||||
i_int = int(i)
|
|
||||||
rqbin_len = 10
|
rqbin_len = 10
|
||||||
if i_int < 10:
|
if len(i) == 1:
|
||||||
rqbin_len = 4
|
rqbin_len = 4
|
||||||
elif i_int < 100:
|
elif len(i) == 2:
|
||||||
rqbin_len = 7
|
rqbin_len = 7
|
||||||
code_temp = bin(i_int)[2:]
|
code_temp = bin(int(i))[2:]
|
||||||
code += ('0'*(rqbin_len - len(code_temp)) + code_temp)
|
code += ('0'*(rqbin_len - len(code_temp)) + code_temp)
|
||||||
return code
|
return code
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user