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

PythonÓïÑÔ¸ÅÀÀ

python
ÓïÑÔ¸ÅÀÀ
 
python
½Å±¾¿ÉÒÔ´¦ÀíÍⲿ´«½øÀ´µÄ²ÎÊý ¼´sys.argv[] 
£¬argv[]
µÄʹÓÃÓëlinux
ÏÂÏàͬ
python
±¾ÉíÊǽâÊÍÓïÑÔ£¬¿ÉÒÔ¶ÔÊäÈëµÄʽ×ÓÇóÖµ¡£python
Ö§³ÖµÄ¶ÔÏóÈçÕûÊý¶¼ÊÇÁ¢¼´Êý£¬´ËÍâËûÖ§³Ö¸´Êý£¬¼°¶ÔËÄÔòÔËËã½âÊÍ¡£
ptyhon
Ö§³Ö×Ö·û´®£¬·ÅÔÚµ¥/
Ë«ÒýºÅÄÚ£¬×Ö·û´®ÊÇÊý×飬¿ÉÒÔͨ¹ý[i:j]
²Ù×÷»ñµÃÖ¸¶¨Î»ÖÃ(i - j-1)
µÄÔªËØ¡£¶àÐеÄ×Ö·û´®¿ÉÒÔ·ÅÔÚ""" 
"""
ÖУ¬Èç¹ûÆäÖаüº¬ÁËתÒå×Ö·û£¬r"""\n"""
¿ÉÒÔÈÃËùÓÐ×Ö·û¶¼Êä³ö¡£
ÖØÔصÄ+ *
²Ù×÷£¬¿ÉÒÔÕ³ºÏ¶à¸ö×Ö·û´®¡£
python
Ö§³ÖµÄlist
ÓÃ[a,b,c]
À´±íʾ£¬¿ÉÒÔͨ¹ý[]
È¡¶ÔÓ¦µÄÔªËØ£¬Ö§³Ö¶à¸öÔªËظ³ÖµÈç a[2:4]=[1,2]
£¬list
ÖеÄÔªËØ¿ÉÒÔÊDz»Í¬ÀàÐ͵ġ£ÀàËÆÓÚlisp
£¬python
ÖеÄlist
¿ÉÒÔǶÌ×£¬Ç¶Ì×µÄlist
×÷Ϊһ¸öÔªËØ¡£
ΪÁ˱éÀúlist
¿ÉÒÔÓÃfor elem in list
£ºµÄ·½Ê½
 
Á÷³Ì¿ØÖÆ
python
ÖÐûÓÐ{}
£¬Ê¹ÓÃËõ½øÀ´±íʾ´úÂë¿é£¬¶ø£º±íʾһ¿é´úÂëµÄ¿ªÊ¼£¬È¡ÏûËõ½ø±íʾ´úÂë¿éµÄ½áÊø¡£
if
x >
0
:
       
print

1
elif
x==
0
:
       
print

0
else
:
       
print
-
1
 
Ìõ¼þ¿ØÖÆ
   
while a>0
   
in / not in
   
A and B or (not C)
 
 
ÀඨÒå
class
ÀàÃû£º
   
ÀàÌå
 
º¯Êý¶¨Òå
def fun(argv,argv=x)
£ºÖ§³ÖĬÈϲÎÊý
    
º¯ÊýÌå
Èç¹ûº¯Êý×îºóµÄÐβÎΪ**name
£¬Ôòº¯Êý½ÓÊմʵ䡣Èç¹ûº¯ÊýÐβÎΪ*name
£¬Ôòº¯Êý½ÓÊÕÒ»¸öÔª×é»òlist
¡£*name
±ØÐëÔÚ**name
֮ǰ¡£
def
fun
(*argv,**names):
   
for
arg
in
argv:
       
print
arg
   
print

'-'
*
40
   
keys = names.keys()
   
for
key
in
keys:
       
print
key,
":"
,names[key]
fun(
'here are some record'
,liming =
'123456'
,ligang=
'123455'
)
 
  
 
½â³ö²ÎÊý£¬


Ïà¹ØÎĵµ£º

PythonÖÐreactor,factory,protocolµÄѧϰ±Ê¼Ç


PythonÖÐreactor,factory,protocolµÄѧϰ±Ê¼Ç
 
 
×îΪ¼òµ¥µÄÇé¿öÏ£¬³ýÁËÁ˽âÇåreactorµÄ¼òµ¥Ê¹Óã¬Ä㻹ҪÁ˽âProtocolºÍFactory¡£ËüÃÇ×îÖÕ¶¼»áÓÉreactorµÄÕìÌý½¨Á¢ºÍrunÀ´Í³Ò»µ÷¶ÈÆðÀ´¡£    
   
     ½¨Á¢·þÎñÆ÷µÄµÚÒ»¸öÒª½â¾öµÄÎÊÌâ¾ÍÊÇ·þÎñÓëÍâ½çµÄ½»Á÷Э ......

python 2.5.x ÕÒ²»µ½ python25_d.lib ½â¾ö

1£®  Ê×ÏȾÍÊÇÔÚ±àÒëÆ÷ÖаÑpython°²×°Ä¿Â¼include/Óëlibs/¼ÓÈ룬¶ÔÓÚÕâµãÎÒÔÚvc6ÖпÉÒÔ£¬µ«ÊÇÔÚdev c++Öм´Ê¹¼ÓÈëÁ˱àÒëÒ²»á³ö´í£¬ËµÕÒ²»µ½pythonÍ·Îļþ£¬Õâµã±È½ÏÓôÃÆ£¬²»¹ý¿¼Âǵ½Ò»°ãwindows±à³Ì¶¼ÓõÄÊÇvc£¬ËùÒÔ²¢Ã»ÓÐʲôӰÏì°É£¡£¡£¡
È»ºóÓÃ#include <Python.h>¾Í¿ÉÒÔ°ÑpythonµÄÖ÷Í·Îļþ°üº¬½øÀ´ÁË¡£
µ«Ê ......

ʹÓÃpython»ñÈ¡htmlÒ³ÃæµÄÄÚÈÝ

import urllib
from HTMLParser import HTMLParser
class TitleParser(HTMLParser):
def __init__(self):
self.title = ''
self.divcontent = ''
self.readingtitle = 0
self.readingdiv = 0
HTMLParser.__init__(self)
def handle_starttag(self, tag, attrs): ......

Install Python + Eric IDE


Install Python Eric IDE
1 Download following things
 
1) Python3.1
 
2) PyQt for python 3.1
(http://www.riverbankcomputing.co.uk/software/pyqt/download) I am using
PyQt-Py3.1-gpl-4.7.3-2.exe
 
3) Eric5 IDE
(http://eric-ide.python-projects.org/eric-download.html)
 
2 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ