展开
拓展 关闭
订阅号推广码
GitHub
视频
公告栏 关闭

隐藏py文件

  • 项目结构如下

  • cmd进入项目根路径,执行如下命令

C:\work\git\default-case-repo\05\test02>python
Python 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import compileall
>>> compileall.compile_dir('./', force=True,legacy=True)
Listing './'...
Listing './lib'...
Compiling './lib\\lib.py'...
Listing './lib\\test'...
Compiling './lib\\test\\test.py'...
Compiling './main.py'...
True
  • 结果如下

  • cmd进入项目根路径,执行如下命令,删除项目中的.py后缀的文件

DEL /S /Q *.py
  • 注意,一定要进入项目根路径执行删除命令,否则会把电脑中所有的.py文件删除
posted @ 2023-10-08 21:16  DogLeftover  阅读(13)  评论(0编辑  收藏  举报