Organising my Python project

前端 未结 4 1790
半阙折子戏
半阙折子戏 2020-12-02 08:41

I\'m starting a Python project and expect to have 20 or more classes in it. As is good practice I want to put them in a separate file each. However, the project directory qu

4条回答
  •  一个人的身影
    2020-12-02 09:12

    simple answer is to create an empty file called __init__.py in the new folder you made. Then in your top level .py file include with something like:

    import mynewsubfolder.mynewclass
    

提交回复
热议问题