close


使用 MySQLdb 連結到 MySQL
有幾點值得注意

盡量都使用utf-8編碼,確保 中文 可以順利 insert進去
若是為select fetchall時出來的 data 是unicode 

conn =MySQLdb.connect(host=config.get('mysql','host'),user=config.get('mysql','user'),passwd=config.get('mysql','passwd'),charset="utf8")

使用 UNI.encode('utf-8') 轉成 str  方便與原始的data比對


arrow
arrow
    文章標籤
    python mysql
    全站熱搜

    peicheng 發表在 痞客邦 留言(0) 人氣()