python ÅжÏÊDz»ÊÇÖÐÎÄ×Ö
ÏÂÃæÕâ¸öС¹¤¾ß°üº¬ÁË ÅжÏunicodeÊÇ·ñÊǺº×Ö£¬Êý×Ö£¬Ó¢ÎÄ£¬»òÕ߯äËû×Ö·û¡£ È«½Ç·ûºÅת°ë½Ç·ûºÅ¡£ unicode×Ö·û´®¹éÒ»»¯µÈ¹¤×÷¡£ »¹ÓÐÒ»¸öÄÜ´¦Àí¶àÒô×ֵĺº×ÖתƴÒôµÄ³ÌÐò£¬»¹ÔÚÕûÀíÖС£
#!/usr/bin/env python
# -*- coding:GBK -*-
"""ºº×Ö´¦ÀíµÄ¹¤¾ß:
ÅжÏunicodeÊÇ·ñÊǺº×Ö£¬Êý×Ö£¬Ó¢ÎÄ£¬»òÕ߯äËû×Ö·û¡£
È«½Ç·ûºÅת°ë½Ç·ûºÅ¡£"""
__author__="internetsweeper <zhengbin0713@gmail.com>"
__date__="2007-08-04"
def is_chinese(uchar):
"""ÅжÏÒ»¸öunicodeÊÇ·ñÊǺº×Ö"""
if uchar >= u'\u4e00' and uchar<=u'\u9fa5':
return True
else:
return False
def is_number(uchar):
"""ÅжÏÒ»¸öunicodeÊÇ·ñÊÇÊý×Ö"""
if uchar >= u'\u0030' and uchar<=u'\u0039':
return True
else:
return False
def is_alphabet(uchar):
"""ÅжÏÒ»¸öunicodeÊÇ·ñÊÇÓ¢ÎÄ×Öĸ"""
if (uchar >= u'\u0041' and uchar<=u'\u005a') or (uchar >= u'\u0061' and uchar<=u'\u007a'):
return True
else:
return False
def is_other(uchar):
"""ÅжÏÊÇ·ñ·Çºº×Ö£¬Êý×ÖºÍÓ¢ÎÄ×Ö·û"""
if not (is_chinese(uchar) or is_number(uchar) or is_alphabet(uchar)):
return True
else:
return False
def B2Q(uchar):
"""°ë½Çתȫ½Ç"""
inside_code=ord(uchar)
if inside_code<0x0020 or inside_code>0x7e: #²»Êǰë½Ç×Ö·û¾Í·µ»ØÔÀ´µÄ×Ö·û
return uchar
if inside_code==0x0020: #³ýÁ˿ոñÆäËûµÄÈ«½Ç°ë½ÇµÄ¹«Ê½Îª:°ë½Ç=È«½Ç-0xfee0
inside_code=0x3000
else:
inside_code+=0xfee0
return unichr(inside_code)
def Q2B(uchar):
"""È«½Çת°ë½Ç"""
inside_code=ord(uchar)
Ïà¹ØÎĵµ£º
ĿǰΪֹ£¬¾ÝÎÒËùÖª£¬ÔÚpythonÖжÔÏó³Ö¾Ã»¯ÓÐÒÔϼ¸ÖÖ·½·¨£º
1. ʹÓÃ(dbhash/bsddb, dbm, gdbm, dumbdbm µÈ£©ÒÔ¼°ËüÃǵÄ"¹ÜÀíÆ÷"( anydbm )¡£Ö»ÌṩÁË Python ×Ö
·û´®µÄÓÀ¾ÃÐÔ´¢´æ. Ìṩһ¸öÀàËÆ×ÖµäºÍÎļþµÄ¶ÔÏ󣬿ÉÒÔÍê³É×Ö·û´®µÄÓÀ¾ÃÐÔ´æ´¢¡£
2. ʹÓÃmarshalºÍpickleÀ´ÐòÁл¯python¶ÔÏ󣬲¢¾ß±¸´æ´¢µ½½éÖÊÉϵĹ ......
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 ......
À´Ô´£º ×÷Õߣºzhaoweikid ·¢²¼Ê±¼ä£º2007-07-04 ÔĶÁ´ÎÊý£º
pythonµÄpoplibÄ£¿éÊÇÓÃÀ´´Ópop3ÊÕÈ¡ÓʼþµÄ£¬Ò²¿ÉÒÔ˵ËüÊÇ´¦ÀíÓʼþµÄµÚÒ»²½¡£
POP3ÐÒé²¢²»¸´ÔÓ£¬ËüÒ²ÊDzÉÓõÄÒ»ÎÊÒ»´ðʽµÄ·½Ê½£¬ÄãÏò·þÎñÆ÷·¢ËÍÒ»¸öÃüÁ·þÎñÆ÷±ØÈ»»á»Ø¸´Ò»¸öÐÅÏ¢¡£pop3ÃüÁîÂëÈçÏ£º
¡¡ÃüÁ ......
Ò»°ã°²×°µÄ¶¼ÊÇPython22°æ£¬wincvs1.3ÐèÒªpython2.1°æ±¾¼°ÒÔÉÏ¡£µ«ÊÇÆô¶¯¹ý³ÌÕÒ²»µ½£¬ÍøÉÏËÑË÷µÄ·½·¨²»´óÊÊÓá£×îºó¾¹ýÊÔÑé·¢ÏÖ£¬°ÑPython22°²×°Â·¾¶ÏµÄpython22.dll¿½±´µ½wincvsµÄ°²×°Ä¿Â¼Ï¡£ÔËÐÐwincvs£¬ok¡£¾õµÃÕâ¸ö·½·¨ºÃÓõĸø¶¥Ï£¡ ......