[Python] How do I write JSON data to a file?

Discussão em 'Python' iniciado por Stack, Janeiro 30, 2025.

  1. Stack

    Stack Membro Participativo

    How do I write JSON data stored in the dictionary data to a file?

    f = open('data.json', 'wb')
    f.write(data)


    This gives the error:


    TypeError: must be string or buffer, not dict
    ​

    Continue reading...

Compartilhe esta Página