How to redirect ‘print’ output to a file?
I want to redirect the print to a .txt file using Python. I have a for loop, which will print the output for each of my .bam file while I want to redirect all output to one file. So I tried to put: f = open(‘output.txt’,’w’) sys.stdout = f at the beginning of my script. … Read more