Oct-23-2022, 04:36 PM
(This post was last modified: Oct-23-2022, 04:36 PM by deanhystad.)
This does not work to remove leading zeros from a binary string.
# probably not good if it starts with zero if rbs[0] == '0': binary = rbs[1:] else: binary = rbsIt works for "011001" but not "0011001". For a more generic solution use lstrip("0"). Use int(binary_string, 2) to convert a binary string to a binary number.