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µÄѧϰ±Ê¼Ç
×îΪ¼òµ¥µÄÇé¿öÏ£¬³ýÁËÁ˽âÇåreactorµÄ¼òµ¥Ê¹Óã¬Ä㻹ҪÁ˽âProtocolºÍFactory¡£ËüÃÇ×îÖÕ¶¼»áÓÉreactorµÄÕìÌý½¨Á¢ºÍrunÀ´Í³Ò»µ÷¶ÈÆðÀ´¡£
½¨Á¢·þÎñÆ÷µÄµÚÒ»¸öÒª½â¾öµÄÎÊÌâ¾ÍÊÇ·þÎñÓëÍâ½çµÄ½»Á÷Ð ......
±àÒëÁËÒ»¸ö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£¬¼òµ¥µÄÁ¦Á¿
¶¹°êÍø¶Ô»¥ÁªÍøÓû§À´ËµÊÇÖªÃûµÄWeb 2.0ÉçÇø£¬µ«¶Ô¿ª·¢Õß¶øÑÔ£¬¸üÖØÒªµÄÊÇÒ»¸öÓ¦ÓÃPython´òÔìµÄ·Ç³£³É¹¦µÄWeb 2.0Õ¾µã¡£
Pythonµ®ÉúÒÑÓÐ20ÄêµÄÀúÊ·£¬Ä¿Ç°¹úÄÚµÄPython·¢Õ¹×´¿öÈçºÎ£¿ÓëÆäËûÓïÑÔ£¨Æ½Ì¨£©Ïà±È£¬PythonÓÐÄÄЩÏÔ¶øÒ×¼ûµÄÓŵ㣿¶¹°êÓ¦ÓÃPython½øÐÐWeb¿ª·¢ÓÐÄÄЩ³É¹¦¾Ñé¿ÉÒÔ½è¼ø£¿´ø×ÅÕâЩΠ......
¶ÓÁУº
Óë¶ÑÕ»ÀàËÆ£¬Í¨¹ýpythonµÄÁбíÀàÐÍÀ´ÊµÏÖ£¬²Î¿¼ help(list)
shoplist=['apple','mango','carrot','banana']
print 'I have',len(shoplist),'items to purchase'
print 'these items are:'
for item in shoplist:
print item,
shoplist.append('rice')
print 'my shopping list is now', shoplist
shoplist. ......