V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
kojp
V2EX  ›  分享发现

好吧,大家肯定都用过的,但我是第一次.chardet

  •  
  •   kojp · 2012-03-28 13:58:14 +08:00 · 2149 次点击
    这是一个创建于 4429 天前的主题,其中的信息可能已经有所发展或是发生改变。
    这个模块非常有用。看了一中午的文档。最好还是感觉这个工具给力!

    下载地址
    http://pypi.python.org/packages/source/c/chardet/chardet-1.0.1.tar.gz#md5=7c28b02bca7847c13bebedaf4df6c5a3


    fp = open("gg.eml", "r")
    fo = open("gg.html","w")
    mail= email.message_from_file(fp)

    res=ParseMail(mail)
    strtype=type(res)
    print strtype.__name__
    #unicode(res,"cp936")
    #print res
    print chardet.detect(res)

    另外,这篇文章也不错。(不知道是不是原作者)
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1012 人在线   最高记录 6547   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:20 · PVG 04:20 · LAX 13:20 · JFK 16:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.