如何使用不同编解码器的数据块读取带有Python3的json文件?

时间:2017-08-21 12:59:58

标签: python json python-3.x encoder-decoder

我有一个json文件,我必须推入MongoDB。存在不同编码的数据段。喜欢

{
    "Type":"File",
    "Start_Time":"2017-08-07T22:15:16.147Z",
    "Finish_Time":"2017-08-07T22:15:16.147Z",
    "Format":"UTF-16LE",
    "Message":"*' ¾Ò ,'H EÌ1Ò (F\/Ò ©Ì -A'8* ©1H ,( *ÌF ('1 ~‘¾*'¾Ò *H'DDG ~'© A14*   ",
    "Name_DB":"Main"}

{
    "Type":"File",
    "Start_Time":"2017-08-07T22:16:51.462Z",
    "Finish_Time":"2017-08-07T22:16:51.462Z",
    "Format":"ASCII",
    "Message":"SMS_CC_NR-InternType ISDN_NP +923330051108  From: UnkNumb Alphanumeric NR:EVC@ TID: 1123103757111462, Dear Retailer, U have successfully recharged 49 Rupee to 03325047863.Your current balance is 11257.00 Rupee.",
    "Name_DB":"Main"
        }

当我尝试读取文件时,会抛出编解码器错误。如您所见,这两个块的格式不同 - utf-16LEASCII

如何阅读此文件?

0 个答案:

没有答案