在Python中组合模块文件 [英] Combining module files in Python

查看:112
本文介绍了在Python中组合模块文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以将类似于Java中的JAR的Python文件放在一起?我需要一种包装一组Python类和函数的方法,但是与标准模块不同,我希望将其存储在一个文件中.

Is there a way to put together Python files, akin to JAR in Java? I need a way of packaging set of Python classes and functions, but unlike a standard module, I'd like it to be in one file.

推荐答案

看看Python Eggs: http ://peak.telecommunity.com/DevCenter/PythonEggs

Take a look at Python Eggs: http://peak.telecommunity.com/DevCenter/PythonEggs

或者,您可以使用常规的zip: http://docs.python.org/library/zipimport.html

Or, you can use regular zips: http://docs.python.org/library/zipimport.html

这篇关于在Python中组合模块文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆