def str_to_bin(user_input):
str_list = list(user_input)
str_to_bin = ('Hello World')
The string 'Hello World' has been turned into a list, so that each character is seperated (because using the replace function in strings only replaces words). But from here on, I have no idea how to change the letter 'ah' to, for example, '000001'. I tried multiple ways but nothing seems to work.
And I want a compact way too, because, obviously converting phrases into binary requires a value for each character.
If doing it with a list isnt the best way to go, how can you replace individual characters in strings?