Skip to content

Commit

Permalink
fixed another bug about number encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
x-hw committed Sep 24, 2016
1 parent f555f38 commit d05f990
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions MyQR/mylibs/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ def numeric_encoding(str):
str_list = [str[i:i+3] for i in range(0,len(str),3)]
code = ''
for i in str_list:
i_int = int(i)
rqbin_len = 10
if i_int < 10:
if len(i) == 1:
rqbin_len = 4
elif i_int < 100:
elif len(i) == 2:
rqbin_len = 7
code_temp = bin(i_int)[2:]
code_temp = bin(int(i))[2:]
code += ('0'*(rqbin_len - len(code_temp)) + code_temp)
return code

Expand Down

0 comments on commit d05f990

Please sign in to comment.