是否可以将 .exe 文件转换为 .py?

Is it possible to convert a .exe file to .py?

我创建了一个 python 脚本的可执行文件(.exe 文件)。

由于磁盘格式化,我丢失了包含原始 python 脚本的文件夹(也没有备份)。

一个偶然的机会,我在驱动器上得到了它的可执行文件。

我可以重新转换它为python脚本吗?

不,你梦寐以求的是decompiler, and cannot really exist (in a reliable and systematic way) for Python (and for most programming languages and their implementations, because they are not homoiconic). Consider that your Python source code is lost (but see also this:分析你的可执行文件需要很多时间,很多技巧,所以实际上不值得付出努力)。

在开发过程中学习使用 version control system (for your future source code). I recommend git. Make backups. Even better, publish your software with a free software license (e.g. on github 或其他)。

您也可以花很多钱(可能是数千欧元或美元)请一些专业公司从损坏的磁盘驱动器中恢复数据(希望还有您丢失的源代码)。这通常不值钱。