How to write to stdout and a file simultaneously?
📁 Advanced Python Topics, question
There is a Python script:
import syssys.stdout = open('my_log.log', 'w')print 'test'It writes all standard output to a file. Question: how can I write to a file and simultaneously output to the console?
You misunderstand the reason for what's happening.
You are asking the question How to delete correctly, but the correct question is
How to copy correctly?
You are passing a reference to the object from ot to ot1, meaning that ot and ot1 point to the same dictionary.
EXAMPLE
x=['wtf', 'justdoit']x1=xx1[0]='omg'print x>> ['omg', 'justdoit'] Log in to leave an answer