ããpython_æ£å表达å¼_å¹é
ä¸æ_ç¨æ·å_ä¸æåæ¯ä¸å线åå·pythonæ£å表达å¼å¹é
ä¸æç¨æ·å
ããpython_æ£å表达å¼_å¹é
ä¸æ_ç¨æ·å_ä¸æåæ¯ä¸å线åå·
ããpython æ£åè¡¨è¾¾å¼ å¹é
ä¸æ ç¨æ·å ä¸æ åæ¯ ä¸å线 åå·
ããæè§pythonå¼è¿ç§åæ³u'string' ur'string'ï¼å¾sbé¿ã è¯è¨è®¾è®¡å
³é®åååæ³çæ¶åï¼ä¸å®ä»ç»èè好ï¼å¦åé¿ï¼åé¢å°±é¾æ¹äºã说æ¥é½æ¯ç¸éçï¼éé·ã
ãã$amp;>amp;>amp;$gt; sys.getdefaultencoding()
ãã'ascii'
ãã$amp;>amp;>amp;$gt; reload(sys)
ãã<module 'sys' (built-in)>
ãã$amp;>amp;>amp;$gt; sys.setdefaultencoding('utf8')
ãã$amp;>amp;>amp;$gt; sys.getdefaultencoding()
ãã'utf8'
ãã$amp;>amp;>amp;$gt; keyword = 'æ'
ãã$amp;>amp;>amp;$gt; re.search(ur"[\u4e00-\u9fa5]+",unicode(keyword,"utf-8"))
ãã<_sre.SRE_Match object at 0xb73aff70>
温馨提示:答案为网友推荐,仅供参考