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

PythonÈëÃŵÄ36¸öÀý×Ó Ö® 24

# 027
toolName = 'Google'
if toolName.startswith('Go'):
print 'The tool\'s name starts with \"Go\".'
if 'oo' in toolName:
print 'The tool\'s name contains the stirng "oo".'
print toolName.find('gl') # ·µ»ØÊ״γöÏÖ“gl”×Ö·û´®µÄË÷Òý
if toolName.find('Baidu'):
print 'Can\'t find "Baidu" in tool\'s name.'
aList = ['a','b','c']
print '...'.join(aList)
output£º
The tool's name starts with "Go".
The tool's name contains the stirng "oo".
3
Can't find "Baidu" in tool's name.
a...b...c


Ïà¹ØÎĵµ£º

Python Ascii to bcd bcd to Ascii

ÔÚÍøÉÏËѲ»µ½¹ØÓÚ Ascii ºÍ bcd»¥Ïàת»¯µÄÎÄÕ£¬ÓÚÊÇ×Ô¼ºÐ´ÁËÒ»¸ö£¬ºÍ´ó¼Ò·ÖÏíÏ¡£
ûÓп¼Âǵ½Ð§ÂÊ£¬Äܹ»ÓÅ»¯µÄµØ·½Íû´ó¼ÒÌá³ö
"""
    AscII×Ö·ûת»»ÎªBCD×Ö·û
"""
def asc2bcd(inAsc, pad_L0_R1 = 0):
#È«²¿×ª»»Îª´óд£¬ÎªºóÃæµÄת»»Ìṩ·½±ã
    inAsc = inAsc.upper()
 &nb ......

Python Re

1. Basic
²Î¿¼¡¶PythonÕýÔò±í´ïʽ²Ù×÷Ö¸ÄÏ¡· 
Ä£¿ére£¬perl·ç¸ñµÄÕýÔò±í´ïʽ
regex²¢²»Äܽâ¾öËùÓеÄÎÊÌ⣬ÓÐʱºò»¹ÊÇÐèÒª´úÂë
regex»ùÓÚÈ·¶¨ÐԺͷÇÈ·¶¨ÐÔÓÐÏÞ×Ô¶¯»ú
2. ×Ö·ûÆ¥Åä(Ñ­Ðò½¥½ø)
Ôª×Ö·û
. ^ $ * + ? { [ ] \ | ( )
1) "[" ºÍ "]"³£ÓÃÀ´Ö¸¶¨Ò»¸ö×Ö·ûÀà±ð£¬Ëùν×Ö·ûÀà±ð¾ÍÊÇÄãÏëÆ¥ÅäµÄÒ»¸ö×Ö·û¼¯¡£Èç[ ......

PythonÄ£¿éѧϰ

¡¡¡¡StringIOµÄÐÐΪÓëfile¶ÔÏó·Ç³£Ïñ£¬µ«Ëü²»ÊÇ´ÅÅÌÉÏÎļþ£¬¶øÊÇÒ»¸öÄÚ´æÀïµÄ¡°Îļþ¡±£¬ÎÒÃÇ¿ÉÒÔ½«²Ù×÷´ÅÅÌÎļþÄÇÑùÀ´²Ù×÷StringIO¡£Ò»¸ö¼òµ¥µÄÀý×Ó£¬ÈÃÄã¶ÔStringIOÓÐÒ»¸ö¸ÐÐÔµÄÈÏʶ£º 1  #coding=gbk 2    3  import StringIO, cStringIO, sys 4    5  s ......

ѧϰ¡¶PythonÓïÑÔÈëÃÅ¡·µÚÎåÕ ģ¿é

Ä£¿éÕⶫÎ÷ºÃÏñûʲôºÃ½²µÄ£¬ÎÞ·ÇÊDZ£´æÒ»·ÝÎļþ£¬È»ºóÔÚÁíÒ»·ÝÎļþÖÐÓÃimport ºÍfrom ** import **(*)¾ÍÐÐÁË¡£
ÕâÒ»ÕÂÖ÷Òª½²µ½ÁËϸ½Ú£¬µ¼ÈëÄ£¿éPythonÀïÃæÊÇʲô´¦ÀíµÄ£¬import ºÍ from ** import **ÓÐʲô²»Ò»Ñù¡£»¹ÓоÍÊÇÔö¼ÓÁËreload()Õâ¸öº¯ÊýµÄʹÓÃ˵Ã÷¡£
ÒÔÇ°¿´µ½ÄÄÀï˵¾¡Á¿Ê¹ÓÃimport¶ø²»ÒªÊ¹ÓÃfrom ** import * ......

PythonÄ£¿éѧϰ

¡¡¡¡ÓÐʱºò£¬Òª°ÑÄÚ´æÖеÄÒ»¸ö¶ÔÏó³Ö¾Ã»¯±£´æµ½´ÅÅÌÉÏ£¬»òÕßÐòÁл¯³É¶þ½øÖÆÁ÷ͨ¹ýÍøÂç·¢Ë͵½Ô¶³ÌÖ÷»úÉÏ¡£PythonÖÐÓкܶàÄ£¿éÌṩÁËÐòÁл¯Óë·´ÐòÁл¯µÄ¹¦ÄÜ£¬È磺marshal, pickle, cPickleµÈµÈ¡£½ñÌì¾Í½²½²marshalÄ£¿é¡£
¡¡¡¡×¢Ò⣺
marshal²¢²»ÊÇÒ»¸öͨÓõÄÄ£¿é£¬ÔÚijЩʱºòËüÊÇÒ»¸ö²»±»ÍƼöʹÓõÄÄ£¿é£¬ÒòΪʹÓÃmarshalÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ