python的import几种形式
2016-05-10 16:25
513 查看
python的import的几种形式:在t1.py中
def out(): print('this is t1') <pre name="code" class="python">def hello(): print('hello world')在t3.py中
import t1t1.out()前面需要加上t1.来说明这是使用的t1文件执行结果为下面换种形式:
import t1from t1 import outout()t1.hello()还可以使用另一种形式:
from t1 import *out()hello()注意此时前面不能加上t1.。
相关文章推荐
- [LeetCode]题解(python):151-Reverse Words in a String
- Python 基础学习笔记1
- Python树结构之一行代码实现
- Python全局变量
- [python网络编程]使用scapy修改源IP发送请求
- python automated headers 自动生成格式化 注释文件 docstrings
- thrift系列 - 多语言实例 for java和python
- [LeetCode]题解(python):149-Max Points on a Line
- 《统计学习方法》-逻辑回归笔记和python源码
- [LeetCode]题解(python):148-Sort List
- Python介绍
- Python内建的对象列表
- [LeetCode]题解(python):147-Insertion Sort List
- [LeetCode]题解(python):146-LRU Cache
- Python处理Excel(四):自定义类处理Excel数据
- python面向对象编程基础II(类的继承)
- Python基础篇【第8篇】: Socket编程(二)SocketServer
- Python实现欧拉计划22题
- python 多个关键字替换
- 102. Binary Tree Level Order Traversal [easy] (Python)