易截截图软件、单文件、免安装、纯绿色、仅160KB

python安装之安装模块制作

python的egg文件有点像java中的jar文件,是一个工程打包文件,便于安装部署,仅此一点,给多少pythoner带来了多少激动。
如何制作egg文件呢?see官方文档http://peak.telecommunity.com/DevCenter/PythonEggs,
到http://pypi.python.org/pypi/setuptools下载setuptools包,然后安装:
python setup.py
1.制作egg文件
下面开始egg文件的制作:(见上一个egg的帖子,比较详细)
在要打包的文件夹父目录中新建setup.py
#setup.py
view plaincopy to clipboardprint?
#coding=utf8  
 
from setuptools import setup, find_packages  
 
setup(  
    name = "eggtest",  
    version = "0.1",  
    packages = find_packages(),  
 
    description = "egg test demo",  
    long_description = "egg test demo",  
    author = "lidehong",  
    author_email = "idehong@gmail.com",  
 
    license = "GPL",  
    keywords = ("test", "egg"),  
    platforms = "Independant",  
    url = "http://blog.csdn.net/hong201/",   
      

#coding=utf8
from setuptools import setup, find_packages
setup(
    name = "eggtest",
    version = "0.1",
    packages = find_packages(),
    description = "egg test demo",
    long_description = "egg test demo",
    author = "lidehong",
    author_email = "idehong@gmail.com",
    license = "GPL",
    keywords = ("test", "egg"),
    platforms = "Independant",
    url = "http://blog.csdn.net/hong201/",
 
)
 
name:包名
version:版本
packages :打包的文件
description:描述信息
author:作者
url:下载


相关文档:

Python实现“各类型文件统计”功能

不多说了,直接看代码吧!
import os
path = 'e:/Download/'
kzm = []
kzmTemp = set()
kzmTemp2 = []
dict = {}
for root,dirs,files in os.walk(path):
    for file in files:
        ext = os.path.splitext(file)[1][1:]
      ......

Amusing Python 2: range/xrange

这两个基本上都是在循环的时候用。
Python
代码 < type="application/x-shockwave-flash" width="14" height="15" src="http://cloudhe.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" src="http://cloudhe.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" flashvars="clipboard=for%20i% ......

Pyke 简介 (3) :调制 Python 函数

对 Python 函数的"调制",是指对其做出合乎需求的设置。具体的调制方法,是将其参数设为固定值(常数)。
设定单一的参数值
原先的函数是这样的:
>>> def foo(cooked, standard):
... print "foo called with cooked: %s, standard: %s" % \
... (cooked, standard) 
调用它:
>>> foo('a', ......

Python的lambda函数与排序

前几天看到了一行求1000的阶乘的Python代码:
print
  
reduce
(
lambda
  
x
,
y
:
x
*
y
,
  
range
(
1
,
  
1001
))

一下子被python代码的精简
与紧凑所折服,故对代码进行了简单的分析。
reduce与range都是Python的内置函数。
range(1,10 ......

Python中Range和XRange的区别

Python中Range和XRange的区别(Difference between Range and XRange in Python)
最近机器出了点问题,所以一直没有写新的东西出来。之前在读Python的代码的时候,发觉好多人喜欢用XRange,而不是Range,我也只是记得学习的时候开始学到的是Range,后面又看到有个XRange,当时也没有深究,为什么Python里面要有两个同样的功 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号