Skip to content

Instantly share code, notes, and snippets.

@FerdinaKusumah
Created August 22, 2021 03:40
Show Gist options
  • Save FerdinaKusumah/2a23114234991dfbd1b89ec13864dc1e to your computer and use it in GitHub Desktop.
Save FerdinaKusumah/2a23114234991dfbd1b89ec13864dc1e to your computer and use it in GitHub Desktop.
Run Python from compile file
import base64
"""
step 1. python -m compileall app.py
step 2. run python with compiled files
python __pycache__/app.cpython-39.pyc
"""
def encode_message(msg):
return base64.b64encode(msg.encode('ascii')).decode('ascii')
def decode_message(msg):
return base64.b64decode(msg).decode('ascii')
message = "Python is fun"
base64_message = encode_message(message)
plain_message = decode_message(base64_message)
if __name__ == "__main__":
print(base64_message)
print(plain_message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment