ÇëÎÊ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
¸Ðл¡«
Ïà¹ØÎÊ´ð£º
RT£¬Ã²ËÆPythonÖ®¸¸Ò²ËµÈç¹ûÄãÏÖÔÚ¿ªÊ¼ÐµÄÏîÄ¿µÄ»°£¬×îºÃÊÇÖ±½ÓʹÓÃPython3£¬¿ÉÊÇʵ¼ÊÉÏ´ó¼ÒʹÓõô󲿷ֻ¹ÊÇ2.5£¬¹À¼ÆÓÃ2.6µÄ¶¼²»ÊǺܶ࣬²¢ÇÒÏà¶ÔÓ¦µÄÐí¶àÀ©Õ¹¶¼Ã»ÓÐ3¶ÔÓ¦µÄ°æ±¾¡£
  ......
ÎÒĿǰµÄÖ÷¹¥ÓïÑÔÊÇ.NET£¬ÏëѧPYTHON£¬¿´ÁËһЩ¼òµ¥µÄ¹ØÓÚpythonµÄ×ÊÁÏ£¬µ«¸Ð¾õ·Ïß²»¶Ô£¬ÏëÇëÅ£ÈËÖ¸µãÏ£º
1.ÈçºÎÈëÃÅ£¬Ä¿Ç°ÒÑÊìÁ·ÕÆÎÕC#ÓïÑÔ£¬ÆäËûÓïÑÔÊìϤµÄÒ²²»ÉÙ£¨Èçjavascript)£¬ÓкõĽ̳Ìû£¬ÓÐÏà¹ØÍ ......
//ÏÂÃæµÄ´úÂëÔËÐÐÕý³£
tomstrs=re.findall(......)
mtxx=''
for tomstr in tomstrs:
tomstr=tomstr.strip()
if tomstr:
mtxx += tomstr ......
±¾ÎÄÕª×Ô¡¶¿É°®µÄPython¡·¡°¹âÅ̹ÊÊ¡±CDay-1 ʵÓû¯ÖÐÎÄ¡£
[img]http://t.douban.com/mpic/s3901817.jpg[/img]
CDay-1 ʵÓû¯ÖÐÎÄÖÐÎÄ´¦Àí£¬Íê³É¹¦ÄܵÄʵÓû¯
ÄãÅöµ½99%µÄÎÊÌ⣬ÆäËûÈË֮ǰÒѾÓöµ½¹ýÁË£¬Ë ......
Èç¹ûÒ»¶Î´úÂë
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()
......