Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert batch pyc to py in Python decompilation

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report