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
Ïà¹ØÎĵµ£º
PythonÖÐÓÐËÄÖÖÄÚ½¨µÄÊý¾Ý½á¹¹£ºList£¬Tuple£¬Dictionary£¬Set¡£±¾ÎÄÖ÷Òª½éÉÜList¡£
ListÊÇÓÃÀ´´æ·ÅÒ»×é¶ÔÏóÐòÁС£¿ÉÒÔÏñlistÖÐÌí¼ÓÔªËØ¡¢É¾³ýÔªËØ£¬Í¬Ê±Ò²¿ÉÒÔÏñ·ÃÎÊÊý×éÒ»Ñù·ÃÎÊlist¡£ListÊǿɱäµÄÊý¾ÝÀàÐÍ¡£
ÏÂÃ棬¸ø³öÒ»×élistµÄÊ¹Ó ......
ÎÒÃǾ³£»á²ÉÓÃÉú²úÕß/Ïû·ÑÕß¹ØϵµÄÁ½¸öÏß³ÌÀ´´¦ÀíÒ»¸ö¹²Ïí»º³åÇøµÄÊý¾Ý¡£ÀýÈçÒ»¸öÉú²úÕßÏ߳̽ÓÊÜÓû§Êý¾Ý·ÅÈëÒ»¸ö¹²Ïí»º³åÇøÀµÈ´ýÒ»¸öÏû·ÑÕßÏ̶߳ÔÊý¾ÝÈ¡³ö´¦Àí¡£µ«ÊÇÈç¹û»º³åÇøµÄ̫С¶øÉú²úÕߺÍÏû·ÑÕßÁ½¸öÒì²½Ï̵߳ÄËٶȲ»Í¬Ê±£¬ÈÝÒ׳öÏÖÒ»¸öÏ̵߳ȴýÁíÒ»¸öÇé¿ö¡£ÎªÁ˾¡¿ÉÄܵÄËõ¶Ì¹²Ïí×ÊÔ´²¢ÒÔÏàͬËٶȹ¤×÷µÄ¸÷Ï̵߳ĵ ......
from: http://www.chinesepython.org/pythonfoundry/tut2.3/tmp/multiple.html
9.5.1 ¶à¼Ì³Ð Multiple Inheritance
Python supports a limited form of multiple inheritance as well. A class definition with multiple base classes looks as follows:
PythonͬÑùÓÐÏÞµÄÖ§³Ö¶à¼Ì³ÐÐÎʽ¡£¶à¼Ì³ÐµÄÀඨÒåÐÎÈçÏÂÀ ......
E-mailÖ÷ÒªÓÉÓʼþÍ·ºÍÓʼþÌåÁ½²¿·Ö×é³É¡£
ÓʼþÍ·ÖеÄÄÚÈݺÍÎÒÃǼÄÐÅʱдÔÚÐÅ·âÉϵÄÄÚÈÝ´óͬСÒ⣬µ±È»ÕâÀïÒ²°üº¬Á˺ܶà·¹ýµÄ“Óʾ֔µÄÐÅÏ¢ÁË¡£
ÓʼþÌåÖеÄÄÚÈݾÍÊÇÎÒÃÇдµÄÐÅ»òÕß°ü¹ü¡£
python×ÔÉí°üº¬ÁËemailÄ£¿é´¦Àí¿ÉÒÔ¿ìËٵĴ¦ÀíE-mailÖеÄÐÅÏ¢
import email
#´ò¿ªÒ»¸öÎļþ
fp = open('email.eml', ' ......