首页 > 解决方案 > 如何将 Python 项目压缩到单个文件中

问题描述

我有以下文件结构

/src
  /test
    extra.py
  main.py

额外的.py

def hello:
  print("hello")

主文件

from test import extra
extra.hello()

是否可以生成单个文件

def hello:
  print("hello")

hello()

标签: python

解决方案


推荐阅读