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

ÕýÔò±í´ïʽÓëpython

 ÔÚPythonÖÐÓÐÒ»¸ö·Ç³£ÖØÒªÒ²·Ç³£ºÃÓõÄÄ£¿ére£¬ÔÚimport reºó£¬¾ÍÄܹ»ÔÚPythonÖÐʹÓÃÕýÔò±í´ïʽ£¬Ô´ÓÚ´Ë´ÎÏîĿҪÓÃÕýÔò±í´ïʽ¶Ôhtml´úÂëÌáȡһ¶¨µÄ×Ö·û£¬ËùÒÔÔÚÕâÒ²¾ÍÓÃЩСÀý×ÓÀ´ÊìϤһÏÂÕýÔò±í´ïʽ
ÏÖÔÚ¾ÍÓÃ×î¼òµ¥µÄÀý×Ó
import re
s='<title>http://www.baidu.com</title>'
print re.findall(r'<\w+>(.+)</',s)
ÔËÐкó½á¹ûΪ
>>>
['http:\\www.baidu.com']
Õâ¸öÏà¶ÔÀ´Ëµ»¹ÊDZȽϼòµ¥µÄ£¬µ«ÊÇÕâ¸öÕýÔò±í´ïʽ»¹ÊÇÓбȽ϶àµÄÎÊÌâ
1¶ÔÓڱȽϸ´ÔÓµÄ×Ö·û´®£¬±ÈÈçǶÌ×Á˱êÇ©µÄ×Ö·û´®£¬¾ÍûÓа취ÁË£¬ÒòΪֻÄܹ»ÅжÏ×îÍâÒ»²ãµÄ<></>±ê¼Ç¶øÒÑ
2ÊÇÕâ¸öÊÇÅжϾßÓÐÀàËÆ<></>±ê¼ÇµÄ×Ö·û´®£¬¶ÔÓÚʵ¼ÊµÄhtmlÖеÄÌáÈ¡£¬»¹ÊÇÒª¼ÓÉϾßÌåµÄÖµ£¬±ÈÈçÊÇtitle£¬»¹ÊÇhead
import re
s='<head><title>http:\\www.baidu.com</title></head>'
print re.findall(r'title>(.+)</title',s)
ÔËÐкóµÃµ½
>>>
['http:\\www.baidu.com']
ËäÈ»ÔÚÕâ¸ö±È½Ï¼òµ¥µÄ´úÂëÖÐÎÒÃǽâ¾öÁËÉÏÊöÁ½¸öÎÊÌ⣬µ«ÊÇÕë¶ÔhtmlÖиü¼Ó¸´ÔӵĴúÂ룬ÎÒ¾õµÃ»¹ÊÇ»áÓкܶàµÄÎÊÌâ
²»¹ý½ñÌìÒ²¾ÍÊǼòµ¥µÄÊìϤһÏÂÕýÔò±í´ïʽ£¬ËùÒÔÒ²¾Í²»ÔÙÈ¥ÉîÈëÑо¿£¬¾­¹ý¶ÓÔ±µÄÌÖÂÛºóÔÚ̽ÌÖ½â¾öÎÊÌâµÄ·½°¸
ÏÂÃæ¸ø³öÒ»¸öÅжÏÓÊÏ䵨ַÊÇ·ñºÏ·¨µÄÕýÔò±í´ïʽ
ÓÊÏäÖ÷Òª°üÀ¨@ºÍ.£¬ËùÒÔÔÚÅжϵÄʱºòÒ²Ö»Ðè¼ÙÈçÕâÁ½¸öÌõ¼þ¾Í¿ÉÒÔÁË
import re
s='zhuangruln@gmail.com  zhuangasdsad@126.com zhusdandsai@adsd'
print re.findall(r'(\w+@\w+\.\w+)',s)
ÔËÐнá¹û
['zhuangruln@gmail.com', 'zhuangasdsad@126.com']
>>>


Ïà¹ØÎĵµ£º

[¶À¼Ò]Google½«ÏÞÖÆPythonÓïÑÔµÄÓ¦Óà ¿ª·¢ÉçÇøÈÈÒé

2009-11-16 
Collin WinterÊÇPythonÉçÇøÒ»Î»ÆÄ¾ßÓ°ÏìÁ¦µÄ¿ª·¢Õߣ¬ËûÔøÊÇCPythonÏîÄ¿µÄºËÐÄ¿ª·¢ÕßÖ®Ò»¡¢Ò²ÔøÊÇUnladen Swallow£¨¼ûÎÄĩעÊÍ£©µÄºËÐÄ¿ª·¢Õߣ¬²ÎÓëÁ˺ܶàPythonÏîÄ¿µÄ¿ª·¢¡£½üÀ´´«ÎÅGoogle½«ÔÚÆäÐÂÏîÄ¿ÖÐÏÞÖÆPythonµÄʹÓã¬Îª´ËÓпª·¢Õߣ¨ÒÔK±íʾ£©ÔÚGoogle ÂÛ̳Öй«¿ªÑ¯ÎÊÁËCollin Winter£¬Collin Winte ......

Eclipse+PyDev = Python±à¼­Æ÷£¬

http://www.ibm.com/developerworks/cn/opensource/os-cn-ecl-pydev/Á¬½ÓÕâ¸öÍøÖ·£¬²»»áÈÃÄãʧÍûµÄ¡£
PyDev ¼ò½é
2003Äê7ÔÂ16ÈÕ£¬ÒÔ Fabio Zadrozny ΪÊ×µÄÈýÈË¿ª·¢Ð¡×éÔÚÈ«Çò×î´óµÄ¿ª·ÅÔ´´úÂëÈí¼þ¿ª·¢Æ½Ì¨ºÍ²Ö¿â SourceForge ÉÏ×¢²áÁËÒ»¿îеÄÏîÄ¿£¬¸ÃÏîĿʵÏÖÁËÒ»¸ö¹¦ÄÜÇ¿´óµÄ Eclipse²å¼þ£¬Óû§¿ÉÒÔÍêÈ«ÀûÓà Eclipse À ......

Python×Ö·û´®²Ù×÷

 #Python×Ö·û´®²Ù×÷
''
'1.¸´ÖÆ×Ö·û´®'
''
#strcpy(
sStr1,
sStr2)
sStr1 =
'strcpy'
sStr2 =
sStr1
sStr1 =
'strcpy2'
print
sStr2
''
'2.Á¬½Ó×Ö·û´®'
''
#strcat(
sStr1,
sStr2)
sStr1 =
'strcat'
sStr2 =
'append'
sStr1 +
=
sStr2
print
sStr1
''
'3.²éÕÒ×Ö·û'
''
#strc ......

PythonÈÕÆÚ²Ù×÷ѧϰ±Ê¼Ç

 http://www.itzn.cn/html/jiaoben/python-perl-VBA/200812/19-3283.html
×Ö·û´®ÊÇʹÓþ²Ì¬µÄ·½Ê½½øÐд洢£¬Ö»ÄܶÁ¶ø²»ÄÜÖ±½ÓÐÞ¸Ä×Ö·ûÄÚÈÝ¡£Ìرð½«Ò»¶Ñ¶Ô×Ö·û´®²¢ÔÚÒ»ÆðµÄʱºò£¬ËäÈ»¿ÉÒÔÖ±½ÓÏà¼Ó£¬Ìý˵ÕâÑùµÄËÙ¶ÈÆæÂý£¬Ö»ÓÐÓÃÆäËüº¯ÊýµÄ·½Ê½½øÐУ¬ºÃÔÚÒ²²»Ì«Âé·³¡£
±ÈÈçÓà print ','.join(datelist)
¾Í¿ÉÒÔ½«date ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ