Konversi file ke base64 python

import base64
data = open("sample.txt", "r").read()
encoded = base64.b64encode(data)
MitchAloha