Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PythonÕýÔò±í´ïʽµÄ³£ÓÃÆ¥ÅäÓ÷¨


ÏÂÃæÁгöPythonÕýÔò±í´ïʽµÄ¼¸ÖÖÆ¥ÅäÓ÷¨£º
1.²âÊÔÕýÔò±í´ïʽÊÇ·ñÆ¥Åä×Ö·û´®µÄÈ«²¿»ò²¿·Ö
regex=ur"" #ÕýÔò±í´ïʽ
if re.search(regex, subject):
    do_something()
else:
    do_anotherthing()
2.²âÊÔÕýÔò±í´ïʽÊÇ·ñÆ¥ÅäÕû¸ö×Ö·û´®
regex=ur"\Z" #ÕýÔò±í´ïʽĩβÒÔ\Z½áÊø
if re.match(regex, subject):
    do_something()
else:
    do_anotherthing()
3.´´½¨Ò»¸öÆ¥Åä¶ÔÏó£¬È»ºóͨ¹ý¸Ã¶ÔÏó»ñµÃÆ¥Åäϸ½Ú(Create an object with details about how the regex matches (part of) a string)
regex=ur"" #ÕýÔò±í´ïʽ
match = re.search(regex, subject)
if match:
    # match start: match.start()
    # match end (exclusive): atch.end()
    # matched text: match.group()
    do_something()
else:
    do_anotherthing()
4.»ñÈ¡ÕýÔò±í´ïʽËùÆ¥ÅäµÄ×Ó´®(Get the part of a string matched by the regex)
regex=ur"" #ÕýÔò±í´ïʽ
match = re.search(regex, subject)
if match:
    result = match.group()
else:
    result = ""
5. »ñÈ¡²¶»ñ×éËùÆ¥ÅäµÄ×Ó´®(Get the part of a string matched by a capturing group)
regex=ur"" #ÕýÔò±í´ïʽ
match = re.search(regex, subject)
if match:
    result = match.group(1)
else:
    result = ""
6. »ñÈ¡ÓÐÃû×éËùÆ¥ÅäµÄ×Ó´®(Get the part of a string matched by a named group)
regex=ur"" #ÕýÔò±í´ïʽ
match = re.search(regex, subject)
if match:
    result = match.group"groupname")
else:
    result = ""
7. ½«×Ö·û´®ÖÐËùÓÐÆ¥ÅäµÄ×Ó´®·ÅÈëÊý×éÖÐ(Get an array of all regex matches in a string)
result = re.findall(regex, subject)
8.±éÀúËùÓÐÆ¥ÅäµÄ×Ó´®(Iterate over all matches in a string)
for match in re.finditer(r"<(.*?)\s*.*?/\1


Ïà¹ØÎĵµ£º

python ÅÀ³æ³ÌÐòÏê½â

1 #!/usr/bin/python ʹÓÃħ·¨×Ö·ûµ÷ÓÃpython
2
3 from sys import argv  µ¼ÈësysÊǵ¼Èëpython½âÊÍÆ÷ºÍËû»·¾³Ïà¹ØµÄ²ÎÊý
4 from os import makedirs,unlink,sep
osÖ÷ÒªÌṩ¶Ôϵͳ·¾¶£¬ÎļþÖØÃüÃûºÍɾ³ýÎļþËùÐèµÄº¯Êý
makedirsÊÇ´´½¨µÝ¹éÎļþ¼ÐµÄº¯Êý¡£±ÈÈç˵ÎÒÃÇÒª´´½¨Ò»¸öеÄĿ¼£¬/python/HTML/crawl,µ«ÊÇÄ ......

ÒÔPython Imaging Library ½øÐÐÓ°Ïñ×ÊÁÏ´¦ÀíPIL


1   Ó°ÏñÓëͼÐÎ×ÊÁϵĴ¦Àí
ÌÖÂÛͼÐÎ(Ó°Ïñ) ±¾ÉíµÄ´¦Àí£¬¶øÌÖÂÛµÄÄÚÈݽ«»á¼¯ÖÐÔÚPython Imaging Library (PIL) ÕâÒ»Ì׳Ìʽ¿âÉÏ¡£
PIL ÊÇPython ÏÂ×îÓÐÃûµÄÓ°Ïñ´¦ÀíÌ×¼þ£¬ÓÉÐí¶à²»Í¬µÄÄ£×éËù×é³É£¬²¢ÇÒÌṩÁËÐí¶àµÄ´¦Àí¹¦ÄÜ£¬ÔÊÐíÎÒÃÇÔÚ¼òµ¥µÄPython ³ÌʽÀï½øÐÐÓ°ÏñµÄ´¦Àí¡£ Ê¹ÓÃÏñPIL ÐíÑùµÄ³Ìʽ¿âÌ ......

[python]PLYÄ£¿é Lex/YACCµÄpythonʵÏÖ

  PLYÄ£¿é ÊÇLex/YACCPython µÄʵÏÖ£¬¿ÉÒÔÓÃÀ´ÊµÏÖ´Ê·¨·ÖÎö/Óï·¨·ÖÎö£¬µ«ÈçºÎÓ㬻¹Ã»Ñо¿£¬ÒÔºóÓÐʱ¼äÔÙÑо¿°É£»
  Ö÷Ò³: http://www.dabeaz.com/ply/
  pycparserÄ£¿é ÊÇʹÓÃPLYÄ£¿é·ÖÎöcÓïÑÔÓï·¨µÄÄ£¿é£¬Ã»Ê²Ã´Îĵµ£¬µ«Ä£¿é×Ô´øÁËÀý×ӺͲâÊÔÓÃÀý¡£
   Ö÷Ò³: http://code.google.com/p/pycpa ......

´î½¨pythonµÄeclipse¿ª·¢»·¾³

Èí¼þ×¼±¸£º
1.eclipse¿ª·¢°ü£¬ÏÂÔØµØÖ·£ºhttp://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR2/eclipse-java-galileo-SR2-win32.zip
2.pydev²å¼þ£¬ÏÂÔØµØÖ·£ºhttp://sourceforge.net/projects/pydev/files/pydev/Pydev%201.5.4/org.python.pydev.feature-1.5.4.2010011921 ......

python ÄÚÖÃÊý¾ÝÀàÐÍ

▾ hide table of contents
0. ¡ü ÏÔʾÍêÕûĿ¼
1. ÉîÈë#
2. ²¼¶ûÀàÐÍ#
3. ÊýÖµÀàÐÍ#
1. ½«ÕûÊýÇ¿ÖÆ×ª»»Îª¸¡µãÊý¼°·´Ïòת»»#
2. ³£¼ûÊýÖµÔËËã#
3. ·ÖÊý#
4. Èý½Çº¯Êý#
5. ²¼¶ûÉÏÏÂÎÄ»·¾³ÖеÄÊýÖµ#
4. Áбí#
1. ´´½¨Áбí#
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ