码迷,mamicode.com
首页 > 编程语言 > 详细

(6)python 函数模块

时间:2017-12-30 15:54:01      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:col   info   file   有关   core   char   desc   图片   list   

 引用模块

def print_list(plist):
    for each_item in  plist:
        if isinstance(each_item,list):
            print_list(each_item)
        else:
            print(each_item)   

保存并命名为 chart2.py 文件

 

打开 python 的IDLE  file-open 打开 chart2.py文件。

技术分享图片

这样便引入了该文件。

验证:

>>> name1=[‘wukong‘,‘li‘,[‘aide‘,‘mali‘]]
>>> print_list(name1)
wukong
li
aide
mali
>>> 

 

发布

1. 为模块创建一个文件夹,把chart2.py 复制到该文件夹下,假设文件夹名为chart2

2.在该文件夹下创建一个叫setup.py的文件

这个文件包含有关发布的元数据,

from distutils.core import setup
setup(
    name=‘chart2‘,
    version=‘1.0.0‘,
    py_modules=[‘chart2‘],
    author=‘meng‘,
    author_email=‘meng.com‘,
    url=‘http://www.meng.com‘,
    description=‘web‘,
)

3.构建一个发布文件

 

3.

 

(6)python 函数模块

标签:col   info   file   有关   core   char   desc   图片   list   

原文地址:https://www.cnblogs.com/buchizaodian/p/8149958.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!