2007年03月23日 星期五 11:40
使用POPLIB,CODECS模块来解析邮件。要取得它的charset的值。 现在已经得到content-type下的值:text/plain; charset="gb2312" 请问怎样才能得到charset的值:gb2312 例子中只是一种情况,想要适合各种有content-type的信件,该如何处理?
2007年03月23日 星期五 21:55
ÓÃÕýÔò±í´ïʽ
re.compile('charset="([^"]+)"').findall(xxx)
ÔÚ07-3-23£¬sunbaole <sun_able在kinca.cn> дµÀ£º
>
> ʹÓÃPOPLIB£¬CODECSÄ£¿éÀ´½âÎöÓʼþ¡£ÒªÈ¡µÃËüµÄcharsetµÄÖµ¡£
> ÏÖÔÚÒѾµÃµ½content-typeϵÄÖµ£ºtext/plain; charset="gb2312"
> ÇëÎÊÔõÑù²ÅÄܵõ½charsetµÄÖµ£ºgb2312
>
> Àý×ÓÖÐÖ»ÊÇÒ»ÖÖÇé¿ö£¬ÏëÒªÊʺϸ÷ÖÖÓÐcontent-typeµÄÐżþ£¬¸ÃÈçºÎ´¦Àí£¿
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070323/21492695/attachment.html
Zeuux © 2025
京ICP备05028076号