Learing Notes

2013年11月27日 星期三

Python String Encoding Conversion (UTF-8/ANSI)

**Python String are recorded in UNICODE internally

Reading file encoded in UTF-8:


with open(fileName,'r') as f:
    for line in f.readlines():
        print line.decode("UTF-8")




張貼者: Unknown 於 晚上11:33 沒有留言:
以電子郵件傳送這篇文章BlogThis!分享至 X分享至 Facebook分享到 Pinterest
標籤: ANSI, Python, Unicdoe, UTF-8
較新的文章 較舊的文章 首頁
查看行動版
訂閱: 文章 (Atom)

網誌存檔

  • ►  2014 (2)
    • ►  6月 (1)
    • ►  2月 (1)
  • ▼  2013 (17)
    • ►  12月 (2)
    • ▼  11月 (1)
      • Python String Encoding Conversion (UTF-8/ANSI)
    • ►  9月 (1)
    • ►  8月 (1)
    • ►  7月 (6)
    • ►  4月 (1)
    • ►  3月 (3)
    • ►  2月 (2)

EWDCHN

簡單主題. 技術提供:Blogger.