Skip to content

Instantly share code, notes, and snippets.

@wallacemaxters
Last active January 7, 2016 17:35
Show Gist options
  • Select an option

  • Save wallacemaxters/9c36cd28874e4e75855e to your computer and use it in GitHub Desktop.

Select an option

Save wallacemaxters/9c36cd28874e4e75855e to your computer and use it in GitHub Desktop.
Pequeno script em python para converter arquivo para base64
#-*- coding: utf-8 -*-
from base64 import b64encode
print "Digite o nome/caminho do arquivo que deseja abrir: \n"
read_filename = raw_input();
with open(read_filename, 'rb') as file:
base64_contents = b64encode(file.read())
print "Agora, digite o nome/caminho do arquivo em que deseja salvar o base64: \n"
write_filename = raw_input()
with open(write_filename, 'wb') as file:
file.write(base64_contents)
print "finalizado com sucesso...\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment