首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

python 怎么共享自己的代码

2013-03-01 
python 如何共享自己的代码?如何发布自己的一个文件,准备如下:movies[The Holy Grail,1975,Terry Gill

python 如何共享自己的代码?
如何发布自己的一个文件,准备如下:
movies=["The Holy Grail",1975,"Terry Gilliam & Terry Jhones",91,
        ["Graham Chapman",
         ["Micheal Pain","Jhon Cleese","Terry Gilliam","Eric Idle","Terry Jones"]]]

"""这是"nester.py"模块,提供了一个名为print_list()函数,这个函数的作用是打印列表,其中有可能包含
(也可能不包含)嵌套列表。"""
def print_list(the_list):
    """这个函数取一个位置参数,名为"the_list“,这可以是任何python列表(也可以是包含嵌套列表的列表)。
    所指定的列表中的没一个数据项会(递归地)输出到屏幕上,各数据项各占一行。"""
    for each_item in the_list:
        if isinstance(each_item,list):
            print_list(each_item)
        else:
            print(each_item)

            
#从python发布工具导入”setup“函数
from distutils.core import setup

setup(
    #函数setup参数名
    name        ='nester',
    version     ='1.0.0',
    py_modules  =['nester'],#模块的元数据与setup函数的参数关联
    author      ='hfpython',
    author_email='laohoubin@163.com',
    url         ='http://www.headfirstabs.com',
    description ='A simple printler of nested lists',
    )

然后从windows下如何发布安装?
[解决办法]
打包工具包:Distutils
[解决办法]
import py2exe
python nester.py py2exe
试试

热点排行