官术网_书友最值得收藏!

Creating an empty package

The first section of this chapter deals with creating a simple empty package, which won't do anything yet, but by the time we're done, we'll be able to import the empty package into the Python shell.

Simple Python projects may consist of a single code module, but normally there are multiple modules combined together into a package. A package can contain as many modules as we need it to. Packages start their lives as folders on the filesystem, which means we can make them just as we would make any other folder.

If you prefer to use your operating system's file browser to make folders, that's fine, but I usually use the command line. For example let's run a demo package:

$ mkdir demopackage

This is shown as the following screenshot:

主站蜘蛛池模板: 南陵县| 栾川县| 日喀则市| 龙里县| 宜都市| 黑龙江省| 崇信县| 荆门市| 永宁县| 海阳市| 曲周县| 郸城县| 建平县| 霍城县| 达拉特旗| 舒兰市| 虞城县| 广灵县| 诏安县| 万载县| 佛冈县| 邵东县| 油尖旺区| 望谟县| 恩施市| 金溪县| 本溪市| 孝义市| 福泉市| 都兰县| 宜兴市| 西青区| 永丰县| 西城区| 临颍县| 枣阳市| 鱼台县| 驻马店市| 博爱县| 永福县| 信阳市|