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

pythonÕýÔò±í´ïʽ ÈçºÎÈ¡³öÒÔÏÂ×Ö·û´® ¶àл

s='aaa111aaa,bbb222,333ccc,444ddd444,555eee666,fff777ggg'

ÓÃÕýÔò±í´ïʽȡ³ö ǰºó×ÖĸÏàͬµÄÊý¾Ý ½á¹ûÈçÏÂ:

111 ddd
лл~
Python code:

import re
s='aaa111aaa,bbb222,333ccc,444ddd444,555eee666,fff777ggg'
p=re.compile(r'(\w)\1{2,}(\w+)(\w)\1{2,}')
m=re.finditer(p,s)
for i in m:
print i.group(2)



Âé·³Äܲ»ÄܽâÊÍһϠÎÒ¸Õ¸ÕÑо¿ÕýÔò±í´ïʽ ¶àл¸ßÈË

(\w)\1{2,}(\w+)(\w)\1{2,} ÓеãСÎÊÌâ
ÐÞÐÞ:
(\w)\1+(\w+)\1{2,}


Â¥Ö÷ûÓбí´ïÈ·È·µÄÒâ˼


"aaa111aaaa" => 111 ?? 111a?? »¹ÊDz»Æ¥Åä??
"aaaa111aaa" => 111 ?? a111?? »¹ÊDz»Æ¥Åä??

r'(\w)\1{2,}(\w+)(\w)\1{2,}' ¿ÉÒÔÓÅ»¯Îª r'(\w)\1{2,}(\w+)\1{3}'
ÕýÔòµÄÖªÊ¶ÍøÉÏ´ó°Ñ´ó°ÑµÄ£¬Ëæ±ãgoogleÒ»¸öÍêÕûµÄ¿´¿´¾ÍokÁË


dddddddddddddddddd

ѧϰÁË.....

Â¥Ö÷µÄÆ¥Å乿ÔòÊDz»ÊǾÍÊÇ×óÓҶԳƵÄÒ»¸ö×Ö·û´®£¬È¡ÖмäµÄ¶Ô³Æµã£¿

Python code:
import re
s='aaa111aaa,bbb222,333ccc,444ddd444,555eee666,fff777ggg'
l=s.split(',')
p=re.compile(r'^(?P<balance>\w+)(?P<target>\w+)(?P=balance)$')
for item in l:
m=p.match(item)
if m != None:
print m.group('target')


(r'^(?P<balance>\w+)(?P<target>\w+)(?P=balance)$')<


Ïà¹ØÎÊ´ð£º

pythonÖÐÏß³ÌÎÊÌ⣿£¿

ÎÒÏÖÔÚÊÇÕâÑùµÄ
¿ªÁËÒ»¸ö×ÓỊ̈߳¬¶ÁÈ¡ÏÂÃæµÄÏûÏ¢
±¾ÒâÊÇ
Python code:

while not self._stopevent.isSet( ):
re=¶ÁȡϲãÏûÏ¢
if re>0:
´¦Àí
else:
pass

¼ÙÈ ......

ÇëÎÊpythonÀïÃæµÄ@ʲôÒâ˼£¿

±ÈÈç

Python code:
@orm.validates('title')
def validate_title(self, key, title):
"""Assure that page titles are wikiwords and valid length"""
......

WindowsÏÂÓÃPythonÄã»á¼¸ÖÖcopyÎļþµÄ·½·¨£¿

1. os.system
Python code:
import os
import tempfile
filename1 = tempfile.mktemp (".txt")
open (filename1, "w").close ()
filename2 = filename1 + ".copy"
print fi ......

pythonÖ´Ðнű¾´øµÄ$@²ÎÊýÊÇʲôÒâ˼£¿

python "$cur_path/script/upgrade.py" "$@"
Äã¿´¿´upgrade.pyµÄÄÚÈݾÍÖªµÀÁË

´«¸ø upgrade µÄÃüÁîÐвÎÊý

°Ñ"$@"¸ø  "$cur_path/script/upgrade.py" ´¦Àí¡£
......

[ÌáÎÊ]Python ÈçºÎºöÂÔ whitespace ¶ÁÈë

Ïñ C µÄ scanf() ÄÇÑù
±ÈÈç¶ÁÈë 1 2 3 a b c
ÿ´Î¶ÁÈëÒ»¸ö
ÏÂÃæÕâ¸öÓ¦¸ÃÊÇÄãÏëÒªµÄ°É£º
Python code:

>>> k = raw_input()
0 0123 ds dsl sd
>>> k
'0 0123 ds dsl sd'
>>> ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ