How do I get rid of the b-prefix in a string in python? December 12, 2022 by Tarik decode the bytes to produce a str: b = b'1234' print(b.decode('utf-8')) # '1234'