Skip to content

Instantly share code, notes, and snippets.

@maliubiao
Last active December 23, 2015 03:09
Show Gist options
  • Save maliubiao/6571974 to your computer and use it in GitHub Desktop.
Save maliubiao/6571974 to your computer and use it in GitHub Desktop.
topyc , compile python source code.
#! /usr/bin/env python
import os.path
import sys
import py_compile
if __name__ == "__main__":
if len(sys.argv) < 2:
print("usage: topyc.py yourfile.py")
exit(0)
path = sys.argv[1]
if path.split(".")[-1] != "py":
print("require a .py file")
exit(0)
py_compile.compile(path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment