
Python
iteye_16329
这个作者很懒,什么都没留下…
展开
-
【Python学习】python哲学
Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. ...2008-03-29 23:05:56 · 297 阅读 · 0 评论 -
新版本代替form_for_model
1.0之前的newforms.form_for_model()和 newforms.form_for_instance()在1.0的forms里面都没有了可以用forms.models.modelform_factory()2009-08-11 23:03:41 · 167 阅读 · 0 评论 -
django自定义tag传入参数
#coding=utf-8from django import templateregister = template.Library()class ZNode(template.Node): def __init__(self,mas): self.ma=ma pass def render(self, conte...2009-08-05 15:48:09 · 493 阅读 · 0 评论 -
Django标签之divisibleby
Example:[code="python"]{% if value|divisibleby:"2" %} Even!{% else %} Odd!{% else %}[/code]Returns True if the value is divisible by the argument.原创 2008-12-11 11:48:21 · 1400 阅读 · 0 评论 -
Django标签之regroup
regroup把一列相似的对象根据某一个共有的属性重新分组。要解释清这个复杂的标签,最好来举个例子。比如, people 是包含 Person 对象的一个列表, 这个对象拥有 first_name 、 last_name 和 gender 属性,你想这样显示这个列表:[code="python"]* Male: * George Bush * Bill ...原创 2008-12-11 11:41:58 · 358 阅读 · 1 评论 -
DJANGO Fastcgi配置
The FastCGIExternalServer directive tells Apache how to find your FastCGIserver. As the FastCGIExternalServer docs explain, you can specify either asocket or a host. Here are examples of both...原创 2008-12-01 16:28:23 · 287 阅读 · 0 评论 -
python代码规范
http://wiki.woodpecker.org.cn/moin/PythonCodingRule2008-11-10 16:56:16 · 120 阅读 · 0 评论 -
Python function decorators
首先定义你自己的方法或者函数。如:[code="python"]def f(): pass[/code]然后定义修饰函数或者方法[code="python"]def H(func): print 'do H' return func[/code]那么如果你给f加上了修饰H那就等于 f = H(f)合起来的代码是:[code="pyth...原创 2008-11-04 17:34:26 · 168 阅读 · 0 评论 -
django摘要
1、^ 表示匹配字符串的最开始, $ 则是匹配字符串的最末 2、settings.py 包含了所有的相关配置,其中一个最重要的配置就是 ROOT_URLCONF ROOT_URLCONF 告诉Django哪个Python模块应该用作 URLconf。3、当服务器收到一个HTTP请求以后,一个服务器特定的 handler 会创建 HttpRequest 并传递给下一个组件并处理。这个 han...2008-10-13 23:31:12 · 358 阅读 · 0 评论 -
样例代码学习
#!/usr/bin/env python#pyaria2.pyimport os, sys, urllibdef usage(): print """Usage: python tharia2.py [OPTIONS] URLOPTIONS: As same as options of aria2c"""def get_url_list(url...原创 2009-07-05 07:08:39 · 156 阅读 · 0 评论 -
Python之urllib使用
>>> import urllib>>> url = r"http://www.ssylgc.com/images/index1.swf">>> path = r"c:/index1.swf">>> data = urllib.urlretrieve(url, path)&2009-06-18 08:10:43 · 118 阅读 · 0 评论 -
linux的jpg支持问题
对于linux的jpeg支持问题。在安装完jpeg的支持包以后,需要把pil从新安装一下,才能生效。2009-05-20 14:35:15 · 316 阅读 · 0 评论 -
PyAmf配置
http://blog.eshangrao.com/2008/02/16/447/搭建Flex和Django的桥梁:PyAmf的安装以上我们已经准备好了后台环境,创建了初始的数据,那么我们的Flex程序如何与Django交互呢,答案是PyAmf,这个是Python的Amf实现,通过他,Flex就可以使用Amf的方式和Python程序交互。值得一提的是,这个支持Amf3。Py...原创 2008-09-17 10:53:00 · 288 阅读 · 0 评论 -
使用pyAmf连接python和flex
Exposing functions for AMF remoting is simple by defining a gateway (a dispatcher) like this[code="python"]# yourproject/yourapp/amfgateway.pyfrom pyamf.remoting.gateway.django import DjangoGa...原创 2008-09-17 10:25:19 · 365 阅读 · 0 评论 -
【DJANGO学习】基本知识点
__init__.py: An empty file that tells Python that this directory should be considered a Python package.manage.py: A command-line utility that lets you interact with this Django project in various ...2008-09-16 23:18:47 · 134 阅读 · 0 评论 -
asyncore.py
asyncore库是python的一个标准库,它是一个异步socket的包装。我们操作网络的时候可以直接使用socket等底层的库,但是asyncore使得我们可以更加方便的操作网络,避免直接使用socket,select,poll等工具时需要面对的复杂。 这个库很简单,包含了一个函数和一个类 * loop()函数 * dispatcher基类 需要注意的是,loop函数是全局的,不是dispat...2008-04-09 10:59:18 · 167 阅读 · 0 评论 -
使用python快速共享文件
一般来说类linux系统之间的文件共享通常使用nfs,而linux 和Windows文件共享则使用samba,这两个服务器功能强大,但是使用起来免不了要配置一番 如果你的机器上装了python可以使用python自带的http服务器 进入你要共享文件的目录执行, ptyhon -m SimpleHTTPServer 对方只要在浏览器里输入你的IP地方加8000端口(例如19...原创 2009-09-17 03:55:04 · 179 阅读 · 0 评论