Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # idx_binary.py
- def idx_binary(binary_string):
- indices = []
- idx = 0
- while 1:
- idx = binary_string.find('1', idx)
- if idx == -1:
- break
- indices.append(idx)
- idx = idx + 1
- return indices
- binary_string = '00110100'
- indices = idx_binary(binary_string)
- print(indices)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement