I have this code:
import base64
words = ('word1',"word2")
for word in words: #for loop
str_encoded = base64.b64encode(word.encode()) # encoding it
print(str_encoded) #print encoded
str_decoded = str_encoded.decode('utf-8')
print(str_decoded)
back = base64.standard_b64decode(str_decoded) # testing if it worked
print(word, "," ,"{{" , str_decoded , "}}" , "," , str_decoded, back) #print test
when i print the test i see the b' wasn't removed.
how can i remove it? thanks!
base64.standard_b64decode()by definition returns abytesobject. If you want to turn that into a string, then callbytes.decode().