Python Ascii to bcd bcd to Ascii
ÔÚÍøÉÏËѲ»µ½¹ØÓÚ Ascii ºÍ bcd»¥Ïàת»¯µÄÎÄÕ£¬ÓÚÊÇ×Ô¼ºÐ´ÁËÒ»¸ö£¬ºÍ´ó¼Ò·ÖÏíÏ¡£
ûÓп¼Âǵ½Ð§ÂÊ£¬Äܹ»ÓÅ»¯µÄµØ·½Íû´ó¼ÒÌá³ö
"""
AscII×Ö·ûת»»ÎªBCD×Ö·û
"""
def asc2bcd(inAsc, pad_L0_R1 = 0):
#È«²¿×ª»»Îª´óд£¬ÎªºóÃæµÄת»»Ìṩ·½±ã
inAsc = inAsc.upper()
print inAsc
#ÅжÏÈç¹û·ÇżÊý¸ö×Ö·ûʱ£¬×ó²¹0£¬»¹ÊÇÓÒ²¹0
import copy
if(len(inAsc)%2 == 1):
if(pad_L0_R1 == 0):
inAsc = copy.copy('0'+inAsc)
if(pad_L0_R1 == 1):
inAsc = copy.copy(inAsc+'0')
#¼ì²âÊäÈëµÄp×Ö·û´®ÖÐÊÇ·ñ¶¼Îª0-9 a-f A-F ÖеÄ×Ö·û
for i in inAsc:
if ((i>='0')and(i<='9')):
continue;
if ((i>='A')and(i<='F')):
continue
print "ÊäÈëÁË·Ç0-9 a-f A-F ÖеÄ×Ö·û"
return
a = array.array('B', inAsc)
v = array.array('B','\x00'*1000)
length = 0
b = 0
c = 0
for i in range(0, len(inAsc), 2):
if ((a[i]>=ord('0'))&(a[i]<=ord('9'))):
b = 0x3
Ïà¹ØÎĵµ£º
¶à¸öÖ´ÐÐÏ߳̾³£Òª¹²ÏíÊý¾Ý£¬Èç¹û½ö½ö¶ÁÈ¡¹²ÏíÊý¾Ý»¹ºÃ£¬µ«ÊÇÈç¹û¶à¸öÏß³ÌÒªÐ޸Ĺ²ÏíÊý¾ÝµÄ»°¾Í¿ÉÄܳöÏÖÎÞ·¨Ô¤ÁϵĽá¹û¡£
¼ÙÈçÁ½¸öÏ̶߳ÔÏót1ºÍt2¶¼Òª¶ÔÊýÖµnum=0½øÐÐÔö1ÔËË㣬ÄÇôt1ºÍt2¶¼¸÷¶ÔnumÐÞ¸Ä10´ÎµÄ»°£¬ÄÇônum×îÖյĽá¹ûÓ¦¸ÃΪ20¡£µ«ÊÇÈç¹ûµ±t1È¡µÃnumµÄֵʱ£¨¼ÙÈç´ËʱnumΪ0£©£¬ÏµÍ³°Ñt1µ ......
ÎÒÃǾ³£»á²ÉÓÃÉú²úÕß/Ïû·ÑÕß¹ØÏµµÄÁ½¸öÏß³ÌÀ´´¦ÀíÒ»¸ö¹²Ïí»º³åÇøµÄÊý¾Ý¡£ÀýÈçÒ»¸öÉú²úÕßÏ߳̽ÓÊÜÓû§Êý¾Ý·ÅÈëÒ»¸ö¹²Ïí»º³åÇøÀµÈ´ýÒ»¸öÏû·ÑÕßÏ̶߳ÔÊý¾ÝÈ¡³ö´¦Àí¡£µ«ÊÇÈç¹û»º³åÇøµÄ̫С¶øÉú²úÕߺÍÏû·ÑÕßÁ½¸öÒì²½Ï̵߳ÄËٶȲ»Í¬Ê±£¬ÈÝÒ׳öÏÖÒ»¸öÏ̵߳ȴýÁíÒ»¸öÇé¿ö¡£ÎªÁ˾¡¿ÉÄܵÄËõ¶Ì¹²Ïí×ÊÔ´²¢ÒÔÏàͬËٶȹ¤×÷µÄ¸÷Ï̵߳ĵ ......
pythonµÄ×Ô¶¯²¹È«Óкܶ෽·¨£¬±¾ÖÊÉ϶¼ÊÇÓÃ×ֵ䡣Éú³É×Öµä×î³£Óõĵ±È»ÊÇctagÁË£¬µ«ÊÇÿ´ÎÔö¼ÓÄ£¿é¶¼ÒªctagÒ»´ÎҲͦÂé·³µÄ¡£
ÄÜ͵ÀÁµÄÊǺó͵ÀÁÊÇÒ»ÖÖÃÀµÂ£¬ÓÐÈËÒѾ×öÁË×ÖµäºÍÔö¼ÓÄ£¿éµÄ½Å±¾£¬ÎÒÃǸÉÂï²»×øÏíÆä³ÉÄØ¡£
http://vim.sourceforge.net/scripts/script.php?script_id=850
Õâ¸öÃûΪpydictionµÄÏîÄ¿°üÀ¨ÁËÒ»¸ö×Ö ......
from: http://www.cnblogs.com/dahuzizyd/archive/2005/03/01/111006.html
pythonÖ§³ÖÃæÏò¶ÔÏóµÄ±à³Ì·ç¸ñ£¬ÕâÀïÖ÷Ҫ˵˵pythonÖеĶà¼Ì³Ð£º
ÏÂÃæµÄ´úÂëʹÓÃpython2.4£¬°²×°ºóʹÓÃidleµÄIDE¿ª·¢»·¾³£¨ËµÊÇIDE £¬±ÈÆðdelphi,VS.netµÈ¼òµ¥µÃÌ«¶àÁË)
´ÓFile-New²Ëµ¥½¨Á¢Ò»¸ö.pyÎļþ£¬Ð´ÏÂÃæµÄ´úÂ룺
class SuperCl ......
pythonʹÓÃSocketServers
SocketServersÄ£¿éΪһ×ésocket·þÎñÀඨÒåÁËÒ»¸ö»ùÀ࣬Õâ×éÀàѹËõºÍÒþ²ØÁ˼àÌý¡¢½ÓÊܺʹ¦Àí½øÈëµÄsocketÁ¬½ÓµÄϸ½Ú¡£
1¡¢SocketServers¼Ò×å
TCPServerºÍUDPServer¶¼ÊÇSocketServerµÄ×ÓÀ࣬ËüÃÇ·Ö±ð´¦ÀíTCPºÍUDPÐÅÏ¢¡£
×¢Ò⣺SocketServerÒ²ÌṩUnixStreamServer(TCPServerµÄ×ÓÀà)ºÍUNIXdatag ......