I new to Python and I'm trying to make this script work, I made this in php, but I'd like to know how to do it in python...
I'm trying to encode a file with base64 and then decode and write the binary data to a file.
import base64
binaryfile = open("original.mp3").read()
file = open("out.txt", "w")
file.write(binaryfile)
file.close()
base64.encode(open("out.txt"), open("out.b64", "w"))
base64.decode(open("out.b64"), open("out.mp3", "w"))
print "original:", repr(binaryfile)
print "encoded message:", repr(open("out.b64").read())
print "decoded message:", repr(open("out.txt").read())
raw_input("\nPress ENTER to exit")
can someone tell me what I'm doing wrong and tell me the proper way to do what I'm looking for