python ÖÐÎÄÎÊÌâ
Èç¹ûPythonÔ´ÎļþÖгöÏÖÖÐÎÄ£¬ÐèÒªÔÚÔ´ÎļþµÚÒ»ÐмÓÉÏÀàËÆÈçϵĴúÂëÒ³Ö¸Á
# -*- coding:gbk -*-
Èç¹û³ÌÐòµÄÔËÐнá¹ûÖаüº¬ÖÐÎÄ£¬¿ÉÒÔÔÚ³ÌÐò¿ªÍ·°üº¬ÈçÏ´úÂ룬¾Í¿ÉÒÔÕýÈ·ÏÔʾÖÐÎĽá¹û£º
import sys
reload(sys)
sys.setdefaultencoding('gbk')
Ïà¹ØÎĵµ£º
Ê×ÏÈ, ˵˵pythonÀïÃæµÄ±Õ°ü°É:
1. ÐèÒªº¯ÊýǶÌ×, ¾ÍÊÇÒ»¸öº¯ÊýÀïÃæÔÙдһ¸öº¯Êý.
2. Íⲿº¯ÊýÐèÒª·µ»ØÒ»¸öÄÚ²¿º¯ÊýµÄÒýÓÃ
3. Íⲿº¯ÊýÖÐÓÐһЩ¾Ö²¿±äÁ¿, ²¢ÇÒ, ÕâЩ¾Ö²¿±äÁ¿ÔÚÄÚ²¿º¯ÊýÖÐÓÐʹÓÃ
¸ÅÄî:
1. ×ÔÓɱäÁ¿: Íⲿº¯ÊýÖж¨ÒåµÄ¾Ö²¿±äÁ¿, ²¢ÇÒÔÚÄÚ²¿º¯ÊýÖб»Ê¹ÓÃ.
2. ±Õ°ü: ÄǸöʹÓÃÁË×ÔÓɱäÁ¿²¢±»·µ»ØµÄÄÚ²¿º¯Ê ......
#¹ØÓڻص÷¹¦ÄܵIJâÊÔ
#FunctorÊÇÕâÖֻص÷¹¦ÄܵĹؼü¶ÔÏó
class Functor:
"""Simple functor class."""
def __init__( self, fn, *args ):
self.fn = fn
  ......
ÔÚStack Overflow ÉÏ¿´µ½Ñ§Ï°Python µÄÒ»¸ö·½·¨ÊÇÓÃPython ÆƽâThe Python Challenge¡£µ«ÎÒϲ»¶ÓÃRuby£¬Ë¹ÜµÃ×ÅÄØ^_^
0. ÈëÃŹغܼòµ¥¡£
p 2**38
1. ÆƽâÒ»¶Î»°£¬¹Û²ìͼƬºÜÈÝÒ×·¢ÏÖ½âÂë±í°Ñ×Öĸ±íÑ»·ÓÒÒÆÁ½Î»¡£
riddle = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl ......
²âÊÔÍøÕ¾£ºBaiduÖ÷Ò³ÒÔ¼°Ïà¹ØµÄÒ³Ãæ
Ö÷Ì⣺ºÚºÐ²âÊÔ£¬¹¦ÄܲâÊÔ£¬ÐÔÄÜ/ѹÁ¦²âÊÔ£¬°²È«²âÊÔ£¬ Êý¾Ý×Öµä¹ÜÀí
1. ²âÊÔÒ³ÃæÊÇ·ñ¿É·ÃÎʵģ»
1.1 HTTP request status = 200, Ò³ÃæÏÂÔØÕýÈ·
from urllib import urlopen
# set up
url = None
# test
url = urlopen('http://www.baidu.com')
assert url.getcode() == 200
# ......
ÒÔǰҲд¹ýһЩ¹ØÓÚ vim »·¾³±äÁ¿µÄÄÚÈÝ£¬Ê¹Óà vim ºÍ python £¬Ã¿Ò»¶Îʱ¼äºó¶¼»áÓÐеÄÌå»á£¬ËùÒÔÒª²»¶Ï×ܽáÁË.
vim Õë¶Ô python µÄÍòÄܲ¹È«£º vim µ±Ç°½ø³ÌÐèÒªÕÒµ½ÏàÓ¦²¹È«Ä£¿é¿âËùÔÚλÖ㬴ËÊÇ¾ÍºÍ python µÄpath»·¾³±äÁ¿Ïà¹Ø¡£
python ´úÂëÔËÐÐʱ: ¶ÔÓÚimport µÄÄ£¿éÒ²ÐèҪȷ¶¨ËüµÄ¾ßÌåλÖÃ,python ½âÊÍÆ÷»áµ½µ±Ç°Â· ......