Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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']
>>>


Ïà¹ØÎĵµ£º

Python Ï̳߳Ø


import Queue, threading, sys
from threading import Thread
import time,urllib
# working thread
class Worker(Thread):
   worker_count = 0
   def __init__( self, workQueue, resultQueue, timeout = 0, **kwds):
       Thread.__init__( self, **kwds ) ......

python ¶íÂÞ˹·½¿é

Õâ¸öËãÊÇC++ǶÈëpython°É£¬ÀûÓÃpythonʵÏÖÏÔʾºÍʼþ´¦Àí£¬C++ʵÏÖÂß¼­
ÒÔºóÓÐʱ¼äÒ²»á·´¹ýÀ´ÊÔÊÔ£º£© 
import pygame
import sys
import os
import ctypes
def cur_file_dir():
#»ñÈ¡½Å±¾Â·¾¶
path = sys.path[0]
#ÅжÏΪ½Å±¾Îļþ»¹ÊÇpy2exe±àÒëºóµÄÎļþ£¬Èç¹ûÊǽű¾Îļþ£¬Ôò·µ»ØµÄÊǽű¾µÄĿ ......

pythonÄ£¿éÖ®poplib: ÓÃpop3ÊÕÈ¡Óʼþ

 
À´Ô´£º ×÷Õߣºzhaoweikid ·¢²¼Ê±¼ä£º2007-07-04 ÔĶÁ´ÎÊý£º
    pythonµÄpoplibÄ£¿éÊÇÓÃÀ´´Ópop3ÊÕÈ¡ÓʼþµÄ£¬Ò²¿ÉÒÔ˵ËüÊÇ´¦ÀíÓʼþµÄµÚÒ»²½¡£
    POP3ЭÒé²¢²»¸´ÔÓ£¬ËüÒ²ÊDzÉÓõÄÒ»ÎÊÒ»´ðʽµÄ·½Ê½£¬ÄãÏò·þÎñÆ÷·¢ËÍÒ»¸öÃüÁ·þÎñÆ÷±ØÈ»»á»Ø¸´Ò»¸öÐÅÏ¢¡£pop3ÃüÁîÂëÈçÏ£º
¡¡ÃüÁ ......

Ò»¸öɾ³ýÎļþµÄPython³ÌÐò

   PythonÊÇÒ»ÖÖÃæÏò¶ÔÏóµÄ½âÊÍÐԵļÆËã»ú³ÌÐòÉè¼ÆÓïÑÔ£¬Ò²ÊÇÒ»ÖÖ¹¦ÄÜÇ¿´ó¶øÍêÉÆµÄͨÓÃÐÍÓïÑÔ£¬ÒѾ­¾ßÓÐÊ®¶àÄêµÄ·¢Õ¹ÀúÊ·£¬³ÉÊìÇÒÎȶ¨¡£Python ¾ßÓнű¾ÓïÑÔÖÐ×î·á¸»ºÍÇ¿´óµÄÀà¿â£¬×ãÒÔÖ§³Ö¾ø´ó¶àÊýÈÕ³£Ó¦Óá£Ëü¾ßÓмòµ¥¡¢Ò×ѧ¡¢Ãâ·Ñ¡¢¿ªÔ´¡¢¿ÉÒÆÖ²ÐÔ¡¢½âÊÍÐÔ¡¢ÃæÏò¶ÔÏ󡢿ÉÀ©Õ¹ÐÔ¡¢¿ÉǶÈëÐÔÒÔ¼°·á¸»µÄ¿âµÈÌØÐÔ£¬ ......

pythonÖг£ÓÃÈÕÆÚ²Ù×÷×ܽá

http://hbszyandong.javaeye.com/blog/377199
# -*- coding: utf-
8
 -*-  
from datetime import
 datetime  
from datetime import
 date  
from time import
 strftime  
from time imp ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ