Is it possible to print to screen and save to file in one-line?
The following saves to file:
with open('file.txt', 'a') as f:
print('hello world', file=f)
And currently to print to screen and save to file would have to do the following:
print['hello world')
print('hello world', file=f)
I can't find any answers out there for one-line.
I guess a function can be defined to avoid lines in code, but still wondering if it is possible to do all in one line