定义:

包:包含__init__.py文件、模块(也是.py文件)

当包被其它模块调用时,首先会执行该包下的__init__文件

包含有模块,包可以有多级

模块的导入:

import

from...import...

当Python导入一个模块时,Python首先查找当前路径;然后查找lib目录、site-packages目录(python\Lib\site-packages)和环境变量PYTHONPATH设置的目录

被调用模块或包路径必须在主文件同级目录或sys.path列出的目录下

>>> import sys
>>> sys.path
['', '/usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/site-packages']

包必须至少含有一个__init__.py文件,__init__.py文件内容可以为空,用于标识该目录是包

__init__.py文件还用于提供同一路径下的模块列表,这样可在主文件中一次导入包中的所有模块

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAkMAAADRCAIAAABAaiGtAAAaIUlEQVR4nO3d30/TWf7H8c9f0V4JV643/rix3qhcuMqFTpoYCYnRkM0YE78aQhxC8k2+CVn5TjeG2SbzVVzjbleGWDRGlmUM29EsKPgtiwODMoJbJ2VknbpF6Fg1n+/UgY+Tfi9aSn9Cf5z2cz79PB85F4r1Y/2c0/PqOedNUTQAAIxM0fsJAABQEpIMAGBsJBkAwNhIMgCAsZFkAABjI8kAAMZGkgEAjI0kAwAYG0kGADA2kgwAYGwkGQDA2EgyAICxkWQAAGMjyQAAxkaSAQCMjSQDABgbSQYAMDaSDABgbCQZAMDYSDIAgLGRZAAAYyPJAADGRpIBAIyNJAMAGBtJBgAwNpIMEOmHpbe9D57+/suJ1p77Vd9+/+VE74OnPyy91fuuw+xIMkCYrx59r3u66NK+evS93vcepkaSAWJ4zBpjseYhzKAfkgwQ4Ielt4k5/RO9Q6WSLfk/yzYj9EKSAQL0PnhqwhhL+y/3Pniqdz/ApEgyQACTlHis337/5YTe/QCTIskAAXRPEUma3v0AkyLJAAF0jxBJmt79AJMiyQABdI8QSZre/QCTIskAAXSPEEma3v0AkyLJAAF0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5nqbauNzUEBt12xNsYSQ/W7G62JeTzLPZ507ihzyQer/CyEFxDFL9sWv5fFv0FJXKIY5S8gqjYkWbnkn2TajMteqyjWfA7pU5LMfqkvvsNU3+yeSbyFC/U1KYp8c06yWJJlWZElv0nWNE3TAkNO+66m+EaNOulsbHQOBdTEVTJXc6G+ptWpJ48ky3KJ1CRrc69utzU6k2I04x77XXXlvuWs8nMQWkCkaZqmzVyqi71rKaqAKPUSyf+mMQuIDIEkM6rcs1Vo8KSsc86qpGlFDXhdzY1t7j6Xa3UNtmbS2djsnkkJiJDXaa9vHsodGqrXUS9mayYlMVKl3WNx/+Y6WOVnJ7aASNM0v7uxLt6bRRUQpV4iwbAFRIZAkhUjfTFh/+1/5l5VlOmyuZJM9Tp2yTrnJHgdisMbGmyuq2tqdg2uRlVops/RVFffVuq2iqgj85xJlnaPK3REzyo/K8EFRP6+pi2NiaVpUQVEqZdIkKyAqMqQZEaVLckCfY2xvQ5dnlHVyZpk1XuPDbnKF1tA5Hc3pnZt4QVEGZdIkKyAqMqQZID+WOUXSVwBkTrprK9rS9u2LqyAKNslpC0gqjIkGQBNM/IqX0QBUcbfjtcuFlBAlPUS0hYQVRmSDICxUUAEkgyAsVFABJIMAMrPZAVEFUaSAQCMjSQDABgbSQYAMDaSDABgbCQZAMDYSDIAgLGRZAAAYyPJAADGRpIBAIyNJAMAGBtJBgAwtv8HlZFGoOhtiz8AAAAASUVORK5CYII=" alt="" />

接下来自定义包

p1的__init__.py

if __name__ == '__main__':
print ('main')
else:
print ('p1 inited')

p2的__init__.py

if __name__ == '__main__':
print ('main')
else:
print ('p2 inited')

p1的m1.py

def func():
print ('p1.m1.func()') if __name__ == '__main__':
print ('m1.py as main processor')
else:
print ('m1.py is called')

p2的m2.py

def func2():
print ('p2.m2.func2()') if __name__ == '__main__':
print ('m2.py as main processor')
else:
print ('m2.py is called')

main.py

from p1 import m1
from p2 import m2 m1.func()
m2.func()

执行主文件(导入文件会执行__init__.py文件)

[root@hy p]# python main.py
p1 inited
m1 is called
p2 inited
m2 is called
p1.m1.func()
p1.m2.func()

  

Python之路【第三篇】:模块的更多相关文章

  1. Python之路(第三篇):Python基本数据类型字符串(二)

    一.基本数据类型1.字符串 str字符串方法介绍(二)a --expandtabs( ) expandtabs( ) 把字符串中的 tab 符号('\t')转为空格参数默认为8,注意字符串原有的空格也 ...

  2. Python之路【第九篇】:Python操作 RabbitMQ、Redis、Memcache、SQLAlchemy

    Python之路[第九篇]:Python操作 RabbitMQ.Redis.Memcache.SQLAlchemy   Memcached Memcached 是一个高性能的分布式内存对象缓存系统,用 ...

  3. python成长之路第三篇(4)_作用域,递归,模块,内置模块(os,ConfigParser,hashlib),with文件操作

    打个广告欢迎加入linux,python资源分享群群号:478616847 目录: 1.作用域 2.递归 3.模块介绍 4.内置模块-OS 5.内置模块-ConfigParser 6.内置模块-has ...

  4. Python之路(第三十七篇)并发编程:进程、multiprocess模块、创建进程方式、join()、守护进程

    一.在python程序中的进程操作 之前已经了解了很多进程相关的理论知识,了解进程是什么应该不再困难了,运行中的程序就是一个进程.所有的进程都是通过它的父进程来创建的.因此,运行起来的python程序 ...

  5. Python之路【第一篇】python基础

    一.python开发 1.开发: 1)高级语言:python .Java .PHP. C#  Go ruby  c++  ===>字节码 2)低级语言:c .汇编 2.语言之间的对比: 1)py ...

  6. 【Python之路】第二篇--初识Python

    Python简介 Python可以应用于众多领域,如:数据分析.组件集成.网络服务.图像处理.数值计算和科学计算等众多领域.目前业内几乎所有大中型互联网企业都在使用Python,如:Youtube.D ...

  7. 初学Python——文件操作第三篇

    一.引言 什么?有了第二篇文件操作还不够?远远不够!而且在读完第三篇文件操作还是不够.关于文件的操作,后续的学习中将不断学习新的操作方式,使用更加合适的方法. 进入正题,上一篇讲到,Python对文件 ...

  8. Python之路【第一篇】:Python简介和入门

    python简介: 一.什么是python Python(英国发音:/ pa θ n/ 美国发音:/ pa θɑ n/),是一种面向对象.直译式的计算机程序语言. 每一门语言都有自己的哲学: pyth ...

  9. Python之路【第一篇】:Python前世今生

    Python简介 Python前世今生 python的创始人为吉多·范罗苏姆(Guido van Rossum).1989年的圣诞节期间,吉多·范罗苏姆为了在阿姆斯特丹打发时间,决心开发一个新的脚本解 ...

  10. Python之路: socket篇

    (默认)与特定的地址家族相关的协议,如果是  ,则系统就会根据地址格式和套接类别,自动选择一个合适的协议 sk import socketip_port = ()sk = socket.socket( ...

随机推荐

  1. C#判断文字是否为汉字

    /// <summary> /// 检测一个字符串是不是以汉字开始 /// </summary> /// <param name="str">要 ...

  2. 通知传值 notification

    @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.textF = [[UITextField ...

  3. J2EE判断重复的数据

    import java.util.ArrayList; import java.util.List; import org.junit.Test; /** * 判断重复的数据 * @author Ya ...

  4. nextSibling,previousSibling,childNodes常见错误

    在使用nextSibling与previousSibling时,常出现选不到预计对象的情况 eg: <div class="a">1</div> <d ...

  5. 【单源最短路模板】 poj 2387

    #include <cstdio> #include <iostream> #include <stdlib.h> #include <memory.h> ...

  6. Spring Boot 系列教程12-EasyPoi导出Excel下载

    Java操作excel框架 Java Excel俗称jxl,可以读取Excel文件的内容.创建新的Excel文件.更新已经存在的Excel文件,现在基本没有更新了 http://jxl.sourcef ...

  7. Spring Boot 系列教程2-Data JPA

    Spring Data JPA 用来简化创建 JPA 数据访问层和跨存储的持久层功能. 官网文档连接 http://docs.spring.io/spring-data/jpa/docs/curren ...

  8. AI 人工智能 探索 (六)

    这次我为 角色 attribute 添加了 多个属性 其中 att 是 好人 坏人 等属性, 显然 数字不同 就要打起来. grade 是智商属性 ,今天先做了 3的智商.也就是小兵智商.碰到就打 逃 ...

  9. margin

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  10. POJ - 3061 Subsequence(连续子序列和>=s的最短子序列长度)

    Description A sequence of N positive integers (10 < N < 100 000), each of them less than or eq ...