May 10th Thursday (五月 十日 木曜日)

  Each module has its own private symbol table, which is used as the global symbol table by
all functions defined in the module. Thus, the author of a module can use global variables
in the module without worrying about accidental clashes with a user's global variables.  On
the other hand, if you know what you are doing you can touch a module's global variables with
the same notation used to refer to its functions, modname.itemname.

  Modules can import other modules. It is customary but not required to place all import
statements at the beginning of a module (or script, for that matter). The imported module names
are placed in the importing module's global symbol table.

  When a module named spam is imported, the interpreter searches for a file named spam.py in
the current directory, and then in the list of directories specified by the environment variable
PYTHONPATH. This has the same syntax as the shell variable PATH, that is, a list of directory names.
When PYTHONPATH is not set, or when the file is not found there, the search continues in an installation
-dependent default path; on Unix, this is usually .:/usr/local/lib/python.

  Actually, modules are searched in the list of directories given by the variable sys.path which is
initialized from the directory containing the input script (or the current directory), PYTHONPATH and
the installation-dependent default.  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值