- 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.
- 黑客攻防從入門到精通(實戰秘笈版)
- 在最好的年紀學Python:小學生趣味編程
- Learning Chef
- C語言最佳實踐
- 速學Python:程序設計從入門到進階
- Training Systems Using Python Statistical Modeling
- 30天學通C#項目案例開發
- Mapping with ArcGIS Pro
- Python滲透測試編程技術:方法與實踐(第2版)
- Mastering High Performance with Kotlin
- 面向對象程序設計教程(C#版)
- 區塊鏈原理、架構與應用(第2版)
- Hadoop MapReduce v2 Cookbook(Second Edition)
- Visual FoxPro程序設計(第二版)
- Kubernetes進階實戰(第2版)