Python ×Ö·û´®·½·¨
Python-String-Function
×Ö·û´®ÖÐ×Ö·û´óСдµÄ±ä»»£º
* S.lower() #Сд
* S.upper() #´óд
* S.swapcase() #´óСд»¥»»
* S.capitalize() #Ê××Öĸ´óд
* String.capwords(S)
#ÕâÊÇÄ£¿éÖеķ½·¨¡£Ëü°ÑSÓÃsplit()º¯Êý·Ö¿ª£¬È»ºóÓÃcapitalize()°ÑÊ××Öĸ±ä³É´óд£¬×îºóÓÃjoin()ºÏ²¢µ½Ò»Æð
* S.title() #Ö»ÓÐÊ××Öĸ´óд£¬ÆäÓàΪСд£¬Ä£¿éÖÐûÓÐÕâ¸ö·½·¨
×Ö·û´®ÔÚÊä³öʱµÄ¶ÔÆë£º
* S.ljust(width,[fillchar])
#Êä³öwidth¸ö×Ö·û£¬S×ó¶ÔÆë£¬²»×㲿·ÖÓÃfillcharÌî³ä£¬Ä¬ÈϵÄΪ¿Õ¸ñ¡£
* S.rjust(width,[fillchar]) #ÓÒ¶ÔÆë
* S.center(width, [fillchar]) #Öмä¶ÔÆë
* S.zfill(width) #°ÑS±ä³Éwidth³¤£¬²¢ÔÚÓÒ¶ÔÆë£¬²»×㲿·ÖÓÃ0²¹×ã
×Ö·û´®ÖеÄËÑË÷ºÍÌæ»»£º
* S.find(substr, [start, [end]])
#·µ»ØSÖгöÏÖsubstrµÄµÚÒ»¸ö×ÖĸµÄ±êºÅ£¬Èç¹ûSÖÐûÓÐsubstrÔò·µ»Ø-1¡£startºÍend×÷ÓþÍÏ൱ÓÚÔÚS[start:end]ÖÐËÑË÷
* S.index(substr, [start, [end]])
#Óëfind()Ïàͬ£¬Ö»ÊÇÔÚSÖÐûÓÐsubstrʱ£¬»á·µ»ØÒ»¸öÔËÐÐʱ´íÎó
* S.rfind(substr, [start, [end]])
#·µ»ØSÖÐ×îºó³öÏÖµÄsubstrµÄµÚÒ»¸ö×ÖĸµÄ±êºÅ£¬Èç¹ûSÖÐûÓÐsubstrÔò·µ»Ø-1£¬Ò²¾ÍÊÇ˵´ÓÓÒ±ßËãÆðµÄµÚÒ»´Î³öÏÖµÄsubstrµÄÊ××Öĸ±êºÅ
* S.rindex(substr, [start, [end]])
* S.count(substr, [start, [end]]) #¼ÆËãsubstrÔÚSÖгöÏֵĴÎÊý
* S.replace(oldstr, newstr, [count])
#°ÑSÖеÄoldstarÌæ»»Îªnewstr£¬countÎªÌæ»»´ÎÊý¡£ÕâÊÇÌæ»»µÄͨÓÃÐÎʽ£¬»¹ÓÐһЩº¯Êý½øÐÐÌØÊâ×Ö·ûµÄÌæ»»
* S.strip([char
Ïà¹ØÎĵµ£º
http://chardet.feedparser.org/ ×Ô¶¯¼ì²â±àÂë
http://effbot.org/zone/celementtree.htm cElementTree
http://github.com/jaybaird/python-bloomfilter bloomfilter
http://docs.python.org/library/threading.html#threading.activeCount threading ......
ΪÁËgoogleµÄgoogle appengine¶øÑ§Ï°python
·¢ÏÖËûÕæµÄ²»ÈçcÓïÑÔºÃѧ£¬µ¹²»ÊÇËûÄѶ®£¬¶øÊÇÏà¹ØÎĵµÌ«ÉÙ£¬¶øÇÒ²»¹æ·¶¡£
Ò²ÐíÊÇÎÒµÄÎÊÌâ°É£¬ÎÒ»¹ÊÇϲ»¶cÓïÑÔµÄÍ·Îļþ£¬»¹ÓÐmsdnµÄÄÇÖÖ°ïÖú¡£Ò»ÑÛ¾ÍÖªµÀʹÓ÷½·¨¡£
˵cÓïÑÔÄÑѧ£¬¿ÉÄÜÊÇÒòΪûÓÐ×Ðϸ¿´ÕâÁ½¸ö¶«Î÷°É ......
ĿǰΪֹ£¬¾ÝÎÒËùÖª£¬ÔÚpythonÖжÔÏó³Ö¾Ã»¯ÓÐÒÔϼ¸ÖÖ·½·¨£º
1. ʹÓÃ(dbhash/bsddb, dbm, gdbm, dumbdbm µÈ£©ÒÔ¼°ËüÃǵÄ"¹ÜÀíÆ÷"( anydbm )¡£Ö»ÌṩÁË Python ×Ö
·û´®µÄÓÀ¾ÃÐÔ´¢´æ. Ìṩһ¸öÀàËÆ×ÖµäºÍÎļþµÄ¶ÔÏ󣬿ÉÒÔÍê³É×Ö·û´®µÄÓÀ¾ÃÐÔ´æ´¢¡£
2. ʹÓÃmarshalºÍpickleÀ´ÐòÁл¯python¶ÔÏ󣬲¢¾ß±¸´æ´¢µ½½éÖÊÉϵĹ ......
ÓÉsubprocess´´½¨Ò»¸ö½ø³Ì£¬È»ºó½øÐмàÊÓ
ÿһÃëÖӲ鿴һ´Î£¬Èç¹ûÕýÔÚÔËÐУ¬´òÓ¡pidºÍrunning£¬Èç¹ûÒÑÍ£Ö¹£¬,¼ÌÐøÖ´ÐÐÈÎÎñ²¢´òÓ¡Termined
shellºÍstdout¾ùÉèÖÃΪFalse
Ò²ÐíÕâ¶Ô×ö²¡¶¾µÄÊØ»¤½ø³ÌºÜºÃ
#!/usr/bin/env python
import subprocess , sys , time
p=subprocess.Popen(['ping','127.0.0.1','-n','10'], she ......
Documentation for C's fopen():
---
r Open text file for reading. The stream is positioned at the beginning
of the file.
r+ Open for reading and writing. The stream is positioned at the
beginning of the file.
w Truncate file to zero length or create text file for writing. The
stream is posi ......