[Python] Use logging print the output of pprint

Discussão em 'Python' iniciado por Stack, Junho 16, 2025.

  1. Stack

    Stack Membro Participativo

    I want to use pprint's output to show a complex data structure, but I would like to output it using the logging module rather than stdout.

    ds = [{'hello': 'there'}]
    logging.debug( pprint.pprint(ds) ) # outputs as STDOUT

    Continue reading...

Compartilhe esta Página