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

´ô´ôµÄPython ±Ê¼Ç


һЩ×ۺϵÄÐÅÏ¢
Python
ÀËõ½øºÜÖØÒª¡£Ã»ÓмâÀ¨ºÅ²»Òª½ô£¬

Python
¸ù¾ÝËõ½øÀ´·Ö¸îÓï¾ä¿é¡£
²ÎÊý²»ÐèÒª¶¨Ò壬¿ÉÒÔÖ±½ÓʹÓá£
Help(var)
²é¿´
var
µÄ°ïÖú¡£
Var
¿ÉÒÔΪÈκζ«Î÷£¬º¯Êý£¬Ä£¿é£¬Àà¡£
Python
ÖеÄ×Ö·û´®ÊDz»¿É±äµÄ¡£
Pass 
±íʾ¿ÕÓï¾ä¿é¡£
# ×¢ÊÍ
 
String
r‘I’m a string’
×ÔÈ»×Ö·û´®£¬²»½øÐÐתÒå¡£
‘I’m a string’ 
תÒå×Ö·û´®¡£
ÓÃ
+
¿ÉÁ¬½Ó×Ö·û´®
target = today + os.sep
+ now + '_' + \        
# \
ÓÃÀ´Á¬½Ó»»ÐеÄ×Ö·û´®
       
comment.replace(' ', '_') + '.zip'
 
º¯Êý
º¯ÊýµÄ¶¨Ò壺
Def function():  
     

DocString
'''Prints the maximum
of two numbers.
The two values must be integers.'''
¾ÍÊǸö×¢ÊÍ¡£¡£¡£µ«ÊÇ¿ÉÒÔͨ¹ýº¯ÊýÃû
.__doc__
À´Êä³ö¡£
help()
Ò²¿ÉÒԴﵽͬÑùµÄ×÷Óá£
 
Ä£¿éÏà¹Ø²Ù×÷
import moduleName –
ÒýÈë
moduleName
Ä£¿é£¬

Ö»Òª¸ÃÄ£¿éÔÚ
python
ϵͳ·¾¶Ï¡£
sys
Ä£¿é°üº¬ÁËÓë
Python
½âÊÍÆ÷ºÍËüµÄ»·¾³Óйصĺ¯Êý¡£
sys.argv
ÖаüÀ¨ÁËÎļþÃû¼°²ÎÊý¡£
sys.path
Öаüº¬ÊäÈëÄ£¿éµÄĿ¼ÃûÁбí
dir(ModuleName)
ö¾ÙÄ£¿éÖеÄËùÓÐÊôÐÔ£¬²ÎÊýΪ¿Õʱ·µ»Øµ±Ç°Ä£¿éµÄËùÓÐÊôÐÔ£¬ÊäÈëµÄÄ£¿é±ØÎªµ±Ç°Ä£¿éÊôÐÔÁбíµÄÒ»Ô±¡£
*
¿ÉÒÔÖ»µ¥¶ÀÔËÐÐÄ£¿éŶ
=v=
 
pyc
Îļþ
×Ö½Ú±àÒëµÄÎļþ¡£ÓÃÓÚʹģ¿éÊäÈë¸ü¼Ó¿ì½Ý¡£ÓëÆ½Ì¨Î޹ء£
 
__name__
ÅжÏÊÇ·ñÊÇÖ÷Ä£¿é
if __name__ ==
'__main__':
 
Áбí
List
list = [a,b,c]
len(list)        
ÁÐ±í³¤¶È
list.sort()      
ÁбíÅÅÐò
list.append(t)   
Áбíĩβ׷¼Ó


 
Ôª×é
Tuple
tuple = (a,b,c)
Ôª×éºÍÁбíÊ®·ÖÀàËÆ£¬Ö»²»¹ýÔª×éºÍ×Ö·û´®Ò»ÑùÊDz»¿É±äµÄ£¬¼´Äã²»ÄÜÐÞ¸ÄÔª×é¡£
³£ÓÃÓÚÊä³ö
print '%s is %d years
old' % (name, age)
 
Dict
ͬ
map
 
ÐòÁÐ
sequence
seq = [a,b,c,d,e]
ÓëÆäËû¼¸ÖÖÈÝÆ÷µÄ²»Í¬ÊÇË÷ÒýºÍÇÐÆ¬¡£
Ë÷Òý£ºµÃµ½Ò»¸öÌØ¶¨ÏîÄ¿
     
seq[2]
ÇÐÆ¬£º¿ÉÒԵõ


Ïà¹ØÎĵµ£º

pythonµÄwebÆôº½

1.»¥ÁªÍø£ºÓÖÒôÒë“ÒòÌØÍø”»òÕß“Ó¢ÌØÍø”£¬ÊÇÖ¸ÔÚARPAÍø»ù´¡ÉÏ·¢Õ¹³öµÄÊÀ½çÉÏ×î´óµÄÈ«ÇòÐÔ»¥ÁªÍøÂç¡£
2.Óйػ¥ÁªÍøµÄЭÒé¿ÉÒÔ·ÖΪ3²ã£º
×îµ×²ãµÄÊÇIPЭÒ飬ÊÇÓÃÓÚ±¨ÎĽ»»»ÍøÂçµÄÒ»ÖÖÃæÏòÊý¾ÝµÄЭÒ飬ÕâһЭÒ鶨ÒåÁËÊý¾Ý°üÔÚÍø¼Ê´«ËÍʱµÄ¸ñʽ¡£
ÉÏÒ»²ãÊÇUDPЭÒéºÍTCPЭÒ飬ËüÃÇÓÃÓÚ¿ØÖÆÊý¾ÝÁ÷µÄ´«Ê ......

¶¯Ì¬ÓïÑÔÖ®ËÄ£ºPython¼ò½é


PythonÊÇĿǰ¹ã·ºÊ¹ÓõÄÒ»ÃŶ¯Ì¬ÓïÑÔ£¬ÀàËÆJava£¬Ô´´úÂë±ØÐëÊ×ÏÈÓɱàÒëÆ÷ת»»³É×Ö½ÚÂ루byte code£©£¬È»ºóÔÙÓɽâÊÍÆ÷À´Ö´ÐÐ×Ö½ÚÂë¡£ÓëJava²»Í¬µÄÊÇ£¬PythonµÄ±àÒëÆ÷ºÍ½âÊÍÆ÷¶¼ÊÇÒ»¸ö³ÌÐò¡£Òò´Ë£¬Ô´´úÂëÒ²¿ÉÒÔÖ±½Ó½»¸øÕâ¸ö±àÒëÆ÷£¯½âÊÍÆ÷À´Ö´ÐС£
ʹÓÃPython±àд³ÌÐò£¬Äã²»ÐèÒªÔ¤ÏÈÉùÃ÷ºÃ±äÁ¿µÄÀàÐÍ£¬ÒòΪPythonÖбäÁ¿µÄÀ ......

ʹÓÃeclipse¿ª·¢Python¡£

Help£­¡·Software Upates£­¡·Find and Install£­¡·Search for new features to install-¡·New remote site£­¡·Ëæ±ãÆð¸önameÈçpydev£¬urlÌî http://pydev.sf.net/updates/ £­¡·È»ºóÕÕ×ÅÌáʾÏÂÔØ°²×°¼´¿É¡£
PydevµÄÅäÖÃ
ÔÚEclipse IDE Ï£¬ ´ò¿ª Window->Preferences... ¶Ô»°¿ò£¬´ÓÓÒ²àµÄÊ÷ÐÎÁбíÖÐÑ¡Ôñ“ PyDev&r ......

beginning python summary chapter 4 ×Öµä

1¡¢PythonÖ®ÖÐΨһÄÚ½¨µÄÓ³ÉäÀàÐ;ÍÊÇ×ֵ䣨Dictionary£©¡£×ÖµäÖеÄÖµ²¢Ã»ÓÐÌØÊâµÄ˳Ðò£¬µ«ÊǶ¼°´Õչؼü×Ö£¨Key£©½øÐд洢£¬¹Ø¼ü×Ö¿ÉÒÔÊÇÊý×Ö¡¢×Ö·û´®£¬ÉõÖÁÊÇÔª×飨Tuple£©¡£
2¡¢×ÖµäµÄÓï·¨£º×ÖµäÃû = {'¼ükeys':'Öµvaules','¼ükeys':'Öµvaules','¼ükeys':'Öµvaules',...}£¬×ÖµäÖаüº¬ºÜ¶à¶Ô£¨³ÆÎªÌõÄ¿items£©£¬ÓÉ£¨keys£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ