Home | Mirror | Search |
>>> b = str.encode(y) >>> type(b) >>> b b’Hello World!’ To alter from bytes to str, capitalize on bytes.decode(). >>> z = b”Hello World!” >>> y = “Hello World!” >>> type(z) >>> type(y) To alter from str to bytes, capitalize on str.encode(). >>> a = bytes.decode(z) >>> type(a) >>> a ‘Hello World!’