Search code examples
pythonlistreplacesplitspace

how to remove space in string list python


So i have list contains with 1 string.

biner_pass = ['00001111000000000000111111111111
00001111111111111111000011111111 11111111111100000000000000000000
11111111111111110000111111111111']

all i want is to remove the space and join all the binary.

i was trying using binerpass = ''.join(biner_pass.split(' ')) or biner_pass.replace(" ", "") but it cannot work. so how to remove space?


Solution

  • The string is the 0-th element of a list with 1 element. Therefore you need

    biner_pass[0].replace(" ", "")