[Python] How to remove return to line in a list in a JSON file?

Discussão em 'Python' iniciado por Stack, Setembro 26, 2024.

  1. Stack

    Stack Membro Participativo

    In Python, I would like to get all elements from my lists BIRD_answer and my_answer in a single row:

    {
    "BIRD_answer":[
    [
    0.043478260869565216
    ],
    [
    0.07042253521126761
    ],
    [
    0.11363636363636363
    ]
    ],
    "my_answer":[
    [
    "MillenniumHighAlternative",
    0.043478260869565216
    ],
    [
    "RanchodelMarHigh(Continuation)",
    0.07042253521126761
    ],
    [
    "DelAmigoHigh(Continuation)",
    0.11363636363636363
    ]
    ]
    }


    To give me a format like this :

    "BIRD_answer":[[0.043478260869565216],[0.07042253521126761],[0.11363636363636363]],
    "my_answer":[["MillenniumHighAlternative",0.043478260869565216],["RanchodelMarHigh(Continuation)",0.07042253521126761],["DelAmigoHigh(Continuation)",0.11363636363636363]]
    }


    I have already tried to use jsbeautifier but doesn't work.

    Continue reading...

Compartilhe esta Página