Convert ascii string to base64 without the "b" and quotation marks

Viewed 10435

I wanted to convert an ascii string (well just text to be precise) towards base64. So I know how to do that, I just use the following code:

import base64
string = base64.b64encode(bytes("string", 'utf-8'))
print (string)

Which gives me

b'c3RyaW5n'

However the problem is, I'd like it to just print

c3RyaW5n

Is it possible to print the string without the "b" and the '' quotation marks? Thanks!

2 Answers
Related