- Daniel Arbuckle's Mastering Python
- Daniel Arbuckle
- 186字
- 2021-07-02 21:09:38
Adding modules to the package
Now, let's take look at how to add actual code to the package and look out for a couple of pitfalls to avoid.
Python modules have the same name as objects that they have as filenames, except without the .py suffix. This means that the filenames need to be valid Python variable names and also that they should use letters and symbols that are reliably available across different operating systems. The following screenshot showns an example for this:

So, module names should not start with a number because Python variables are not allowed to start with numbers. Also, it should not use capital letters because some common operating system don't differentiate between filenames containing capital letters and filenames that are all lowercase. As long as we stay within Python variable name guidelines and remember to use a .py suffix, we can name our modules anything we please.
So, we just pick a filename and start writing Python code into a file with that name in the package folder. That simple scenario is also the common case, but there's another possibility.
- Instant Node Package Manager
- Learning C# by Developing Games with Unity 2020
- INSTANT Weka How-to
- Flash CS6中文版應用教程(第三版)
- Mastering Unity Shaders and Effects
- 自然語言處理Python進階
- HTML5與CSS3基礎教程(第8版)
- Create React App 2 Quick Start Guide
- 大學計算機基礎
- Python程序設計開發寶典
- 并行編程方法與優化實踐
- Python自然語言理解:自然語言理解系統開發與應用實戰
- Yii2 By Example
- Java 7 Concurrency Cookbook
- Natural Language Processing with Python Cookbook