What are the requirements for naming python modules?

后端 未结 3 845
醉梦人生
醉梦人生 2021-01-14 10:25

I\'ve been going through Learn Python The Hard Way as a sort of refresher. Instead of naming each example ex#.py (where # is the number of the exercise), however, I\'ve just

3条回答
  •  遥遥无期
    2021-01-14 11:06

    The explicit rules for what is allowed to be a valid identifier (variable, module name etc.) can be found here: https://docs.python.org/dev/reference/lexical_analysis.html#identifiers

    In your case, this is the relevant sentence:

    Within the ASCII range (U+0001..U+007F), the valid characters for identifiers are the same as in Python 2.x: the uppercase and lowercase letters A through Z, the underscore _ and, except for the first character, the digits 0 through 9.

提交回复
热议问题