Avatar ·

Como escrever no Stdout e em um arquivo ao mesmo tempo?

📁 python, pergunta

Existe um script Python:

   import  syssys.studout =  open  ( 'my_log.log' ,  'w' )   print   'test'      

ele escreve toda a saída padrão para o arquivo. Pergunta: Como posso escrever no arquivo e ao mesmo tempo exibir no console?