Anasayfa / python / python file to base64

python file to base64

def file_to_base64(file_path: str) -> str:
    with open(file_path, "rb") as binnary_file:
        encoded_string = base64.b64encode(binnary_file.read())
    return encoded_string.decode('utf-8')

 

Hakkında ibrahim

İlgili Makaleler

python locale.Error: unsupported locale setting locale.setlocale(locale.LC_ALL, ‘Turkish_Turkey.1254’)

if os.name == 'nt': locale.setlocale(locale.LC_ALL, 'Turkish_Turkey.1254') yeni windows updateleri ile artık Türkiye (‘Turkish_Türkiye’, ‘1254’)

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir