I'm trying to store the print output from a function of another module imported, as a string and write it into a file. However, that function does not return a string, it only prints the output. so I need something like:
import someModule
......
f.open('test.v','w')
out = storetheprintoutputasstring(someModule.main())
f.write(out)
f.close
How do I do this? Please help me out and thank you in advance
$python someModule.py > output_file.txtIf not, then you'll want to read in from stdout and write to your file. I'm operating under the assumption that you don't need to have this done dynamically.