May-05-2019, 11:32 PM
what i have done many times, because i don't know if it is safe to replace sys.stdout, and because i am running on Linux, is open the file and get the file descriptor, and replace stdout at that layer like:
if fd!=1: os.dup2(fd,1) os.close(fd)i usually sys.stdout.flush() before that for consistent output.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.