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

PythonÈëÃŵÄ36¸öÀý×Ó——15 ĬÈϲÎÊý

# 015
# ĬÈϲÎÊýµÄ±¾ÖÊÊÇ:
# ²»ÂÛÄãÊÇ·ñÌṩ¸øÎÒÕâ¸ö²ÎÊý,ÎÒ¶¼ÊÇÒªÓÃËü,
# ÄÇôÎÒ¾ÍÒªÏëºÃÔÚÄã²»ÏòÎÒÌṩ²ÎÊýµÄʱºòÎÒ¸ÃʹÓÃʲô¡£
# »òÕߣ¬ÕâÑùÀ´Àí½â£º
# ÓÐһЩ²ÎÊýÔÚÒ»°ãÇé¿öÏÂÊÇÔ¼¶¨Ë׳ɵģ¬
# µ«£¬ÔÚ¼«ÉÙÇé¿öÏ»áÓÐһЩºÜÓиöÐÔµÄÈË»á´òÆÆ´«Í³¶ø°´ÕÕ×Ô¼ºµÄÏ°¹ßÀ´×öÊÂ
def theFirstDayInAWeek(theDay = 'Sunday'):
print theDay
# end of def
theFirstDayInAWeek()
theFirstDayInAWeek('Monday')
# ×¢Ò⣺
# Ö»ÓÐÔÚÐβαíĩβµÄÄÇЩ²ÎÊý¿ÉÒÔÓÐĬÈϲÎÊýÖµ
# ÀýÈ磺def func(a, b=5)ÊÇÓÐЧµÄ£¬µ«ÊÇdef func(a=5, b)ÊÇÎÞЧµÄ

output:
1
2
Sunday
Monday


Ïà¹ØÎĵµ£º

python_ÀàÐͺͶÔÏó


Python ³ÌÐòÖеÄÒ»ÇÐÊý¾Ý¶¼ÊǶÔÏ󡣶ÔÏó°üÀ¨×Ô¶¨Òå¶ÔÏó¼°»ù±¾µÄÊý¾ÝÀàÐÍÈçÊýÖµ¡¢×Ö·û´®¡¢ÁÐ±í¡¢×ÖµäµÈ¡£ÄãÄܹ»ÒÔÀà»òÀ©Õ¹ÀàÐ͵ķ½Ê½´´½¨×Ô¶¨Òå¶ÔÏó¡£±¾ÕÂÖ÷ÒªÃèÊö Python¶ÔÏóÄ£Ðͼ°µÚËÄÕÂ--ÔËËã·ûÓë±í´ïʽÖÐÒªÓõ½µÄһЩԤ±¸ÖªÊ¶¡£
 
1.1. ÊõÓï
³ÌÐòÖеÄÒ»ÇÐÊý¾Ý¶¼ÊǶÔÏó£¬Ã¿¸ö¶ÔÏó¶¼ÓÐÈý¸ö»ù±¾ÊôÐÔ£¬¼´±êʶ(ÀàË ......

PythonÖÐÓÐȤµÄ±äÁ¿¸³Öµ

PythonÓïÑÔÖУ¬Á¬±äÁ¿ºÍËüµÄ¸³Öµ¶¼ÊǺÜÓÐÒâ˼µÄÊÂÇé¡£
ÄãÖ»ÐèÒªÔÚʹÓÃËüµÄʱºòÈÓ¸øËüÒ»¸öÖµ£¬È»ºóÔÚËüµÄ×÷ÓÃÓòÄÚʹÓÃËü¡£ÆäËûµÄÊÂÇé²»ÐèÒªµ£ÐÄ¡£python½âÊÍÆ÷»áÍê³ÉʣϵÄÊÂÇé¡£
1. >>>x = 1
2. >>>x
3. 1
4. >>>
µ±È»Ä㻹¿ÉÒÔÏÔʽµÄɾ³ýËü£¬µ«ÔÚÕâÖ®ºóÄã¾Í²»ÄÜÔÙÒýÓÃÕ⸠......

pythonÀàÐÍת»»£¬ÊýÖµ²Ù×÷(ת)


http://hi.baidu.com/guzhilei1986/blog/item/8969b4debe99e150ccbf1ae7.html
º¯Êý                       ÃèÊö  
int(x [,base ])          ......

Python Ascii to bcd bcd to Ascii

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

£¨×ª£©Python×Ö·û´®µÄencodeÓëdecode isinstance

Ê×ÏÈÒª¸ãÇå³þ£¬×Ö·û´®ÔÚPythonÄÚ²¿µÄ±íʾÊÇunicode±àÂ룬Òò´Ë£¬ÔÚ×ö±àÂëת»»Ê±£¬Í¨³£ÐèÒªÒÔunicode×÷ΪÖмä±àÂ룬¼´ÏȽ«ÆäËû±àÂëµÄ×Ö·û´®½âÂ루decode£©³Éunicode£¬ÔÙ´Óunicode±àÂ루encode£©³ÉÁíÒ»ÖÖ±àÂë¡£
decodeµÄ×÷ÓÃÊǽ«ÆäËû±àÂëµÄ×Ö·û´®×ª»»³Éunicode±àÂ룬Èçstr1.decode('gb2312')£¬±íʾ½«gb2312±àÂëµÄ×Ö·û´®×ª»»³ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ