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

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

±ÈÈç

Python code:
@orm.validates('title')
def validate_title(self, key, title):
"""Assure that page titles are wikiwords and valid length"""
if len(title) > 40:
raise ValueError('Page title must be 40 characters or fewer')
if not wikiwords.match(title):
log.warning('%s: invalid title (%s)' % (self.__class__.__name__,
title))
raise ValueError('Page title must be a wikiword (CamelCase)')
return title


¸Ðл¡«


Ïà¹ØÎÊ´ð£º

Python 3 ·¢²¼Õâô¾ÃÁË£¬ÊÇʱºò×ªÒÆÁËô£¿

    RT£¬Ã²ËÆPythonÖ®¸¸Ò²ËµÈç¹ûÄãÏÖÔÚ¿ªÊ¼ÐµÄÏîÄ¿µÄ»°£¬×îºÃÊÇÖ±½ÓʹÓÃPython3£¬¿ÉÊÇʵ¼ÊÉÏ´ó¼ÒʹÓõô󲿷ֻ¹ÊÇ2.5£¬¹À¼ÆÓÃ2.6µÄ¶¼²»ÊǺܶ࣬²¢ÇÒÏà¶ÔÓ¦µÄÐí¶àÀ©Õ¹¶¼Ã»ÓÐ3¶ÔÓ¦µÄ°æ±¾¡£
    ......

ÈçºÎѧϰpython£¬ÈçºÎÈëÃÅ£¬ÈçºÎ¾«Í¨£¬ÇëÅ£ÈËÖ¸µãÏÂ

ÎÒĿǰµÄÖ÷¹¥ÓïÑÔÊÇ.NET£¬ÏëѧPYTHON£¬¿´ÁËһЩ¼òµ¥µÄ¹ØÓÚpythonµÄ×ÊÁÏ£¬µ«¸Ð¾õ·Ïß²»¶Ô£¬ÏëÇëÅ£ÈËÖ¸µãÏ£º

1.ÈçºÎÈëÃÅ£¬Ä¿Ç°ÒÑÊìÁ·ÕÆÎÕC#ÓïÑÔ£¬ÆäËûÓïÑÔÊìϤµÄÒ²²»ÉÙ£¨Èçjavascript)£¬ÓкõĽ̳Ìû£¬ÓÐÏà¹ØÍ ......

µÚÒ»´ÎÓÃPythonд³ÌÐò£¬Ê¹ÓÃfindº¯ÊýÓöµ½Ò»¸öÎÊÌâ

//ÏÂÃæµÄ´úÂëÔËÐÐÕý³£

tomstrs=re.findall(......)
mtxx=''
for tomstr in tomstrs:
  tomstr=tomstr.strip()
  if  tomstr:
      mtxx += tomstr ......

PythonÖÐÎÄ´¦Àí£¬Íê³É¹¦ÄܵÄʵÓû¯

±¾ÎÄÕª×Ô¡¶¿É°®µÄPython¡·¡°¹âÅ̹ÊÊ¡±CDay-1 ʵÓû¯ÖÐÎÄ¡£
[img]http://t.douban.com/mpic/s3901817.jpg[/img]
CDay-1 ʵÓû¯ÖÐÎÄÖÐÎÄ´¦Àí£¬Íê³É¹¦ÄܵÄʵÓû¯
ÄãÅöµ½99%µÄÎÊÌ⣬ÆäËûÈË֮ǰÒѾ­Óöµ½¹ýÁË£¬Ë ......

Ë­Óùýpython µÄmock ×öunit test

Èç¹ûÒ»¶Î´úÂë

Python code:

#!/usr/bin/python2.5
from urllib2 import Request,urlopen,URLError
def check():
req = Request('http://www.google.com')
try:
res = urlopen(req).read()
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ