摘要: http://blog.csdn.net/navygong/archive/2009/08/20/4467471.aspx1. __call__、__getattr__ 1 class B(): 2 def __call__(self, name): 3 return getattr(self, name) 4 5 def a(self, text): 6 print 'a' + text 7 8 def b(self, text): 9 print 'b' + text 10 11 class A(): 12 def __getattr__(self, nam 阅读全文
posted @ 2011-06-22 21:31 bettermanlu 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 原文地址:http://hi.baidu.com/python23python模块之ConfigParser: 用python解析配置文件 在程序中使用配置文件来灵活的配置一些参数是一件很常见的事情,配置文件的解析并不复杂,在python里更是如此,在官方发布的库中就包含有做这件事情的库,那就是ConfigParser,这里简单的做一些介绍。ConfigParser解析的配置文件的格式比较象ini的配置文件格式,就是文件中由多个section构成,每个section下又有多个配置项,比如:[db]db_host=127.0.0.1db_port=3306db_user=rootdb_pass= 阅读全文
posted @ 2011-06-22 21:21 bettermanlu 阅读(284) 评论(1) 推荐(0) 编辑
摘要: http://fedoraproject.org/wiki/A_Short_RPM_TutorialHow to create a GNU Hello RPM package(Redirected fromA Short RPM Tutorial)Author: Przemek KlosowskiThis is a short hands-on tutorial on writing RPM files, showing how to quickly step up to create simple source and binary software packages. I assume f 阅读全文
posted @ 2011-06-01 04:20 bettermanlu 阅读(449) 评论(0) 推荐(0) 编辑
摘要: http://kezhong.wordpress.com/2009/06/19/setting-up-a-local-yum-server/Setting Up a Local yumServerYUM is a package manager for RPM-compatible Linux systems. You can use it to install or update packages through the internet without considering dependencies. However, if you cannot connect to the inter 阅读全文
posted @ 2011-06-01 02:23 bettermanlu 阅读(357) 评论(0) 推荐(0) 编辑
摘要: http://adminschoice.com/crontab-quick-referenceCrontab – Quick ReferenceSetting up cron jobs in Unix and Solariscron is a unix, solaris utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon. These tasks are often termed as cron jobs in unix , sol 阅读全文
posted @ 2011-05-28 08:48 bettermanlu 阅读(290) 评论(0) 推荐(0) 编辑
摘要: http://www.grabner-online.de/div_into/html/ch09s04s03.html9.4.3 Example:sitecustomize.py# sitecustomize.py # this file can be anywhere in your Python path,# but it usually goes in ${pythondir}/lib/site-packages/import syssys.setdefaultencoding('iso-8859-1') sitecustomize.pyis a special scrip 阅读全文
posted @ 2011-05-28 01:02 bettermanlu 阅读(255) 评论(0) 推荐(0) 编辑
摘要: What is __init__.py usedfor?http://effbot.org/pyfaq/what-is-init-py-used-for.htmFiles named __init__.py are used to mark directories on disk as a Python package directories. If you have the filesmydir/spam/__init__.pymydir/spam/module.pyandmydiris on your path, you can import the code in module.py a 阅读全文
posted @ 2011-05-20 05:33 bettermanlu 阅读(283) 评论(0) 推荐(0) 编辑
摘要: How to use *args and **kwargs in Pythonhttp://www.saltycrane.com/blog/2008/01/how-to-use-args-and-kwargs-in-python/Or,How to use variable length argument lists in Python.The special syntax,*argsand**kwargsin function definitions is used to pass a variable number of arguments to a function. The singl 阅读全文
posted @ 2011-05-20 04:13 bettermanlu 阅读(227) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/chenzehe/archive/2010/10/21/1857170.htmlEclipse是由java开发的,所以要想让Eclipse跑起来就得安装jdk,在命令行里输入javac就能查看本机是否已经安装好了jdk了。1、安装jdk先从oracle官网上下载jdk,放到/usr/local/src/文件中,由于找不到linux的下载连接,所以只能在界面中用FF直接下载了。Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighligh 阅读全文
posted @ 2011-05-12 11:28 bettermanlu 阅读(483) 评论(0) 推荐(0) 编辑
摘要: http://www.voidspace.org.uk/python/articles/urllib2.shtmlurllib2 - The Missing ManualHOWTO Fetch Internet Resources with Pythonurllib2 is a Python module for fetching URLs(Uniform Resource Locators). It offers a very simple interface, in the form ofthe urlopen function. This is capable of fetching U 阅读全文
posted @ 2011-04-10 11:09 bettermanlu 阅读(418) 评论(0) 推荐(0) 编辑