Óà Python 3 дµÄÃüÁîÐаٶȴʵä
½ñÌìÊǵڶþÌì×Ô¼º¿´¹ØÓÚPythonÁË£¬¿´¼ûÒ»¸öPython2дµÄ°Ù¶È´Êµä£¬ÎÒÒ²ÓÃPython 3 дÁËÒ»¸ö¡£ÕæµÄºÜСÇÉ£¬ºÇºÇ£¬ºÜºÃµÄÓïÑÔ¡£
²»ÖªµÀÔõôÉÏ´«´úÂë¸ñʽµÄ£¬¾ÍÉÏ´«Îı¾ÁË£º
# -*- coding: utf8 -*-
import urllib.parse
import urllib.request
def search(word):
#word = input("ÊäÈëÄãÒª²éѯµÄµ¥´Ê:")
url="http://m.baidu.com/s?word="+word+"&ssid=0&from=0&bd_page_type=1&uid=frontui_1273397350_2416&mark=3"
s = (urllib.request.urlopen(url).read()).decode("UTF-8")
p=s[s.find("<div>")+5:s.find("</div>")-12]
q=p.split("<br/>")
for i in range(0,len(q)):
q[i]=q[i][0:(q[i].find("[<img"))]
q[i]=q[i][0:(q[i].find("<img"))]
print(q[i])
search(input("ÊäÈëÄãÒª²éѯµÄµ¥´Ê:"))
search(input("ÊäÈëÄãÒª²éѯµÄµ¥´Ê:"))
22:27:40
Ïà¹ØÎĵµ£º
±àÒëÁËÒ»¸öwindowsϵÄpython3Á¬½ÓMysqlµÄ¿â
mypysql
°æ±¾ÊÇ 0.5.1 £¬¸ù¾Ý¹Ù·½µÄÐÞ¸ÄÈÕÖ¾£¬Õâ¸ö°æ±¾ÐÞ¸ÄÁË0.5ÖÐÒ»¸öÄÚ´æй©ÎÊÌâ¡£
Ô´´úÂëºÍ±àÒëºóµÄÎļþΪ£º
http://211.147.215.55/down/mypysql-0.5.1-win.zip
mypysqlµÄ¹Ù·½µØÖ· https://sourceforge.net/projects/mypysql/
......
Ç°ÑÔ£º
×î½üÓÖÏëѧϰpython,ÓÖÏëÈ¥ÎÂÏ°Ò»ÏÂËã·¨£¬ÓÚÊǾÍÏë³öÁËÕâ¸öÁ½²»ÎóµÄ·½·¨,^_^
¶ÑÕ»£º
ʹÓÃpythonµÄÁбí½á¹¹£¬ÏêÇé¿ÉÒԲ鿴help(list)
#Filename: stack.py
shoplist=['apple','mango','carrot','banana']
shoplist.append('rice')
popitem=shoplist[-1]
del shoplist[-1]
print 'the popitem is',popitem
......
#from pp3e Chapter 9.3
#############################################################################
# popup three new window, with style
# destroy() kills one window, quit() kills all windows and app; top-level
# windows have title, icon, iconify/deiconify and protocol for wm events;
# there ......
1.open
ʹÓÃopen´ò¿ªÎļþºóÒ»¶¨Òª¼ÇµÃµ÷ÓÃÎļþ¶ÔÏóµÄclose()·½·¨¡£±ÈÈç¿ÉÒÔÓÃtry/finallyÓï¾äÀ´È·±£×îºóÄܹرÕÎļþ¡£
file_object = open('thefile.txt')
try:
all_the_text = file_object.read( )
finally:
file_object.close( )
×¢£º²»Ä ......
ǰһƪÎÄÕÂдµÄÔÚAPACHE°²×°MOD_PYTHONµÄ¾¹ý,Æäʵͦ¼òµ¥,¾ÍÊÇ°æ±¾²»¼æÈݵÄÎÊÌâ.Õâ´ÎÎÒ´ó¸Å˵ϲ¿ÊðDJANGOµÄ¹ý³Ì.
ÏÈÐÞ¸ÄAPACHEÅäÖÃÎļþ,ʹÆä¼ÓÔØmod_pythonÄ£¿é
LoadModule python_module libexec/mod_python.so
ÔËÐÐÃüÁî²é¿´
bin/httpd -M¿ÉÒÔ¿´µ½
python_module (shared)
Syntax OK
˵Ã÷apacheÒѾ³É¹¦¼Ó ......