vim python µÄpath»·¾³±äÁ¿
ÒÔǰҲд¹ýһЩ¹ØÓÚ vim »·¾³±äÁ¿µÄÄÚÈÝ£¬Ê¹Óà vim ºÍ python £¬Ã¿Ò»¶Îʱ¼äºó¶¼»áÓÐеÄÌå»á£¬ËùÒÔÒª²»¶Ï×ܽáÁË.
vim Õë¶Ô python µÄÍòÄܲ¹È«£º vim µ±Ç°½ø³ÌÐèÒªÕÒµ½ÏàÓ¦²¹È«Ä£¿é¿âËùÔÚλÖ㬴ËÊÇ¾ÍºÍ python µÄpath»·¾³±äÁ¿Ïà¹Ø¡£
python ´úÂëÔËÐÐʱ: ¶ÔÓÚimport µÄÄ£¿éÒ²ÐèҪȷ¶¨ËüµÄ¾ßÌåλÖÃ,python ½âÊÍÆ÷»áµ½µ±Ç°Â·¾¶£¬$python_path µÈ·¾¶
find ~/.local/lib -type d -print > ~/.local/lib/python2.6/site-packages/python_path.pth
Ïà¹ØÎĵµ£º
ÓõķֱðÊÇtimeºÍdatetimeº¯Êý
'''
Created on 2009-9-2
@author: jiangqh
'''
import time,datetime
# date to str
print time.strftime("%Y-%m-%d %X", time.localtime())
#str to date
t = time.strptime("2009 - 08 - 08", "%Y - %m - %d")
y,m,d = t[0:3]
print datetime.datetime(y,m,d)
Êä³öµ±Ç°Ê±¼ä ......
ÏîÄ¿ÐèÒª£¬¸Õ¸Õ½Ó´¥python¡£
½ñÌì¿´Êé¿´µ½a>b==c £¬a,b,cΪinteger
ÔÚC/C++/C#ÖУ¬a>bΪboolean,²»¿ÉÓëinteger±È½ÏÏàµÈ
µ«python a>b==cµÈЧÓÚ((a>b)&&(b==c))
ÔÚpythonÖеÄд·¨ÊÇa>b and b==c ......
¡¡¡¡ÔÚpythonÖÐÈç¹ûҪʹÓÃfork»òÕßmultiprocessÀ´×ö¶à½ø³Ì£¬¼ÙÈçimportµÄ¿âºÜ¶à»òÕߺܴó£¬ÀýÈçwxpython£¬²é¿´¸÷½ø³ÌµÄÄÚ´æÕ¼ÓÃÄã»á·¢ÏÖÁ½¸ö½ø³ÌµÄÄÚ´æÕ¼Óûù±¾ÉÏÏàͬ£¬»»¾ä»°Ëµ£¬Èç¹ûµÚ¶þ¸ö½ø³Ì¸ù±¾²»ÐèÒªÓõ½wxµÄÄÚÈÝ£¬ËüÒ²»á±»¼ÓÔص½ÄÚ´æµ±ÖÐÈ¥¡£¾ÍÄÃwxÀ´×öÀý×Ó£¬Ã»ÓÐimport t wxÕ¼Óôó¸Å8M+Äڴ棬һµ©import wx£¬ÄÚ´æÂíÉ ......
ÔÚ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
# ......