How to convert batch pyc to py in Python decompilation
This article will explain in detail how to convert pyc to py in batches in Python decompilation. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
What is a pyc file
Pyc is a kind of binary file, which is compiled by py file and generated. It is a kind of byte code,py file that becomes pyc file, the loading speed is improved, and pyc is a kind of cross-platform bytecode, which is executed by python virtual machine, which is similar to the concept of JAVA or. Net virtual machine.
Using uncompyle6, you can convert pyc files to py files, so you can also call CMD for batch operations as follows:
Import osimport sysdef walk_dir (dir,topdown=True): words= [] words= ['asyncio.','attr.','bs4.','chardet.','Crypto.','chardet.','concurrent.','ctypes.','dateutil.','distutils.','email.','et_xmlfile.','fiona.','geographiclib.','geojson.','geopandas.','geopy.','html.','http.','importlib.','jinja2.' 'multiprocessing.','numpy.','openpyxl.','pandas.','pkg_resources.','pyecharts.','pyproj.','pytz.','requests.','setuptools.','shapely.','simplejson.','soupsieve.','sqlalchemy.','unittest.','urllib3.','xlsxwriter.','xml.','xlrd.'] For root, dirs, files in os.walk (dir, topdown): for name in files: if name.endswith ('.pyc'): part_name = name [0:-4] part_file_name = os.path.join (root, part_name) .replace ("\\" "/") isconvert=True for w in words: if (name.startswith (w)): isconvert=False break if isconvert: os.system ('uncompyle6-o "% s.py"% s.pyc "'% (part_file_name) Part_file_name)) print (part_file_name) walk_dir (os.getcwd ())
About "how to batch pyc to py in Python decompilation" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.