Code compiler and decompiler (.py file and file system conversion .pyc)

# .Pyc the .py file into a file, code-behind needs to achieve, .pyc the converted file will be under the current directory in __pycache__ file folder.

Using the same file using the # .pyc .py file.

.py -> .pyc

  • import compileall
    compileall.compile_dir(folder path)
    

     

.pyc -> .py

  • # Installation uncompyle 
    PIP install uncompyle 
    
    # name.pyc to decompile name.py 
    uncompyle6 name.pyc> name.py
    

      

Guess you like

Origin www.cnblogs.com/pppig/p/11423274.html