First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!
1 | initial version |
Maybe you are looking for this solution:
import sys
sys.stdout = open('output.txt','w')
print('Hello!')
This way, you only have to use print
to write to the file.