[Ô´´]PythonÄÚ´æй©²é¿´Æ÷ʵÏÖ
[Ô´´]PythonÄÚ´æй©²é¿´Æ÷ʵÏÖ
by AKara 2009-04-23 @ http://blog.csdn.net/akara @ akaras@163.com
---------------------------------------------------------------------
Ϊ¸üºÃ¶¨Î»PythonÄÚ´æй©Çé¿ö£¬Ð´ÁËÒ»¸öеÄPythonÄÚ´æй©²é¿´Æ÷Ä£¿é¡£
Ä£¿éÓÐÈçϹ¦ÄÜ£º
* ½«ËùÓжÔÏó°´¿òͼÒýÓùØϵÊä³öpngͼƬ
* ¿Éµ÷ÕûÊä³öÿÒýÓòã½ÚµãµÄ×î´óÊýÁ¿
* ¿Éµ÷Õû驶ÔÏóÍùÉÏÒýÓõIJã´ÎÊýÁ¿
* ¸÷ÖÖÀàÐͶÔÏóÓÃΨһµÄÑÕÉ«±êʶ
* 驶ÔÏóÔÚÔÑÕÉ«ÉÏȾºìÉ«
* 驶ÔÏóÏà¹ØµÄlinkÓúìÉ«ÏßÌõ/ºìÉ«ÎÄ×Ö
* ÓÃ<>Ìرð±êʶPython¶ÔÏóµÄÌØÊâ½á¹¹linkÎÄ×Ö
ËùÒÔ£¬¸ù¾ÝÉÏͼ£¬ÐèҪȥ³ýÄÚ´æй©Ҫ×öµÄ¹¤×÷¾ÍÊÇ¡¾Ïû³ýºìÉ«¿ò¡¿£¬
×î¼òµ¥µÄ·½Ê½ÊÇ¡¾Ïû³ýËùÓкìÉ«link¡¿£¬µ«ÕâÏÔÈ»²»ÊÇ×îÓÐЧµÄ·½·¨————
×îÓÐЧµÄ·½·¨ÊǾ¡Á¿ÇжÏ"¶¥²¿"µÄlink(Ôõô²ÅËã"¶¥²¿"£¬ÒÀÀµ¹¦ÄÜÂß¼Åж¨)¡£
---------------------------------------------------------------------
PythonÌṩÁËgc.get_referrers·½·¨À´»ñµÃÒ»¸ö¶ÔÏóµÄÒýÓÃÕßÁÐ±í£¬ºÜ´ó³Ì¶È
ÉÏ£¬ÕâÒѾÍê³ÉÁËÄ£¿éµÄ50%µÄ¹¦ÄÜÁË£ºÒòΪֻҪwhileÑ»·È¡µ½get_referrers
²¢Èë³öË«¶Ë¶ÓÁУ¬Ö±ÖÁ´¦ÀíΪ¿Õ¼´¿É¡£
µ«ÊÇÔÚÊä³ö¶ÔÏóÒýÓùØϵµÄÓÐÏò±ßÐÅϢʱ£¬ÐèÒª×ÐϸµØ¶ÔtypesÄ£¿éÖÐËù
¶¨ÒåµÄ¸÷ÖÖÀàÐ͵ÄPython¶ÔÏó½øÐÐÇø±ð¶Ô´ý£¬ÉõÖÁÓÐЩPythonµÄÄÚ²¿¶ÔÏóÀàÐÍ
Á¬typesÄ£¿éÖж¼Ã»¸ø³ö£¬»òÁ¬Python ManualÊÖ²áÉ϶¼²»¶à˵һ¾ä :( £º
(1)CellType: Ò»ÖÖÓÃÓÚÖ¸Ïòupvalue(LuaÖÐÕâÑù½Ð£¬¾ÍÕâÑù³Æºô°É)µÄ¶ÔÏó£¬
Ëü¿É±»Ò»¸ö»ò¶à¸öclousureµÄfree var tupleÒýÓá£ËäÈ»Python²»Ï£Íû
ʹÓÃÕß×¢ÒâÕâ¸öÄÚ²¿µÄ¶ÔÏóÀàÐÍ£¬µ«ÊÇ¿ÉÒÔ×Ô¼º¶¯ÊÖÈ¡µÃ£º
CellType = type((lambda x: lambda: x)(1).func_closure[0])
(2)NewStyleClassType: ¾ÍÊÇnew style class(ºÍold style classÏà¶ÔµÄ)¡£
·í´ÌµÄÊÇPython´ÓÒýÈënew style classÒÔÀ´¾ÍÌᳫÞðÆúold style class
(ÎÞÂÛ´ÓÐÔÄÜÉÏ£¬·½±ãÐÔÉÏ£¬¹¦ÄܶàÑùÐÔÉÏnew style class¾ùʤ)£¬µ«ÊÇ
Ïà¹ØÎĵµ£º
ת×Ô£º
http://hi.baidu.com/feng2211/blog/item/8b86b6d9816a3f2710df9b79.html
ºÍ
http://i.19830102.com/archives/164
Python °æ±¾£º2.6
ÏÂÔصØÖ·£ºhttp://www.python.org/download/releases/2.6.1/
ÏÂÔØmsiÎļþ²¢°²×°
MySQLdb°æ±¾£º MySQL-python-1.2.2.win32-py2.6.exe
ÏÂÔصØÖ·£ºhttp://home.netimperia.com/ ......
#½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z.py
#for folder all file do 7z
import os
import sys
import distutils.file_util
def ImportOkFile():
if(os.path.isfile("D:\\Records\\½«Ò»Ð©ÀàÐ͵ÄÎļþѹËõΪ7z_record.txt")==False):
f=open("D:\\Reco ......
ÎÊÌâÃèÊö
ÔÚC++ºÍPython»ìºÏ±à³ÌÖУ¬ÔÚÈí¼þ·¢²¼µÄʱºòÐèÒª½«pythonµÄ½âÊÍÆ÷´ò°üµ½°²×°³ÌÐòÖУ¬ÎªÁËÌá¸ßÓû§ÌåÑ飬ÎÒÃÇÐèÒªÈÃÓû§¸Ð¾õ²»µ½pythonµÄ°²×°£¬Èç¹ûÓû§ÒѾ°²×°ÓÐpythonµÄ»·¾³£¬ÎÒÃÇÒ²Òª±£Ö¤²»Ó°ÏìÏÖÓеÄϵͳ¡£
½â¾ö·½°¸
ÔÚPython2.5ÒÔºó£¬pythonÖ§³Ö´ÓzipÎļþÖжÁÈ¡python½Å±¾Îļþ£¬Ö§³Ö¶ÁÈ¡py£¬pyc£¬pyo£¬²»Ö ......
´úÂë+½á¹û£¬²»×ö½âÊÍ
µ±È»£¬¶ÔÓÚpythonûÓÐvirtual functionһ˵£¬¹À¼Æµ±×÷¶Ô±ÈÒ»¸öÀý×Ó¿´¿´°É¡£
#include <iostream>
using namespace std;
class base
{
public:
virtual void foo() { cout << "base" << endl; }
base() { foo() ;}
};
class derive: public base
{
pub ......
ÕâÁ½ÌìÔÚѧϰpythonÓïÑÔ£¬Ò²Ñ§×ÅдÁ˸öͨѶ²¾£¬Á·Ï°ÈëÃÅÏ£¡
¹¦ÄÜ°üÀ¨ÒÔÏ£º
1¡¢Ôö¼ÓÒ»Ìõ¼Ç¼
2¡¢É¾³ýÒ»Ìõ¼Ç¼
3¡¢ÐÞ¸ÄÒ»Ìõ¼Ç¼
4¡¢²éѯһÌõ¼Ç¼
5¡¢ÏÔʾÕû¸öͨѶ²¾
6¡¢°ïÖúÌáʾ
7¡¢°æ±¾ÏÔʾ
8¡¢Í˳öµÈ
Ê×ÏȽ¨Á¢Ò»¸öPersonÀ࣬¼´Person.pyÎļþ£¬ÓÃÀ´±£´æÁªÏµÈ˼Ǽ£º
class Person:
def __init__(self, nam ......