¶ÔpythonµÄisinstanceµÄÈÏʶ
>>> class objA:
... pass
...
>>> A = objA()
>>> B = 'a','V'
>>> B
('a', 'V')
>>> C = 'a string'
>>> print instance(A,objA)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'instance' is not defined
>>> print isinstance(A,objA)
True
>>> print isinstance(B,tuple)
True
>>> print isinstance(C,tuple)
False
>>> print isinstance(C,string)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'string' is not defined
>>> print isinstance(C,basestring)
True
>>>
Ïà¹ØÎĵµ£º
Chapter 1
Python and XML
Python and XML are two very different animals, each with a rich
history. Python is a full-scale programming language that has grown
from scripting world roots in a very organic way, through the vision
and guidance of Python's inventor, Guido van Rossum. Guido continue ......
http://hbszyandong.javaeye.com/blog/377199
# -*- coding: utf-
8
-*-
from datetime import
datetime
from datetime import
date
from time import
strftime
from time imp ......
Ê×ÏÈÒª¸ãÇå³þ£¬×Ö·û´®ÔÚPythonÄÚ²¿µÄ±íʾÊÇunicode±àÂ룬Òò´Ë£¬ÔÚ×ö±àÂëת»»Ê±£¬Í¨³£ÐèÒªÒÔunicode×÷ΪÖмä±àÂ룬¼´ÏȽ«ÆäËû±àÂëµÄ×Ö·û´®½âÂ루decode£©³Éunicode£¬ÔÙ´Óunicode±àÂ루encode£©³ÉÁíÒ»ÖÖ±àÂë¡£
decodeµÄ×÷ÓÃÊǽ«ÆäËû±àÂëµÄ×Ö·û´®×ª»»³Éunicode±àÂ룬Èçstr1.decode('gb2312')£¬±íʾ½«gb2312±àÂëµÄ×Ö· ......
ÔÚPythonÖÐÓÐÒ»¸ö·Ç³£ÖØÒªÒ²·Ç³£ºÃÓõÄÄ£¿ére£¬ÔÚimport reºó£¬¾ÍÄܹ»ÔÚPythonÖÐʹÓÃÕýÔò±í´ïʽ£¬Ô´ÓÚ´Ë´ÎÏîÄ¿ÒªÓÃÕýÔò±í´ïʽ¶Ôhtml´úÂëÌáÈ¡Ò»¶¨µÄ×Ö·û£¬ËùÒÔÔÚÕâÒ²¾ÍÓÃЩСÀý×ÓÀ´ÊìϤһÏÂÕýÔò±í´ïʽ
ÏÖÔÚ¾ÍÓÃ×î¼òµ¥µÄÀý×Ó
import re
s='<title>http://www.baidu.com</title>'
print re.findall(r'&l ......
ÒÔÏÂÄÚÈÝתÔØ×Ôjavaeye.comµÄ×÷Õßbluecrystal
»·¾³ËµÃ÷£ºÒÔÏÂpython´úÂë¾ùÔÚpython2.5ÏÂͨ¹ý¡£
×î½ü¿´µ½Ò»Ð©ÈËÔÚÌÖÂÛpythonÖÐÀàÊôÐÔºÍÀàµÄʵÀýµÄÊôÐÔ£¬ÎÒÒ²À´Ì¸Ì¸ÎÒ¸öÈ˶ÔÕâ¸öÎÊÌâµÄ¿´·¨£¬¹©pyer²Î¿¼¡£
Ê×ÏÈÎÒÃÇÀ´¼òµ¥µÄ¶¨ÒåÒ»¸öpythonµÄÀࣺ
Python´úÂë
# coding:  ......