Output to a file

Output to a file:

1
with open('/tmp/test.out','w') as fp:
2
for i in range(5):
3
fp.write(str(i))
4
#It writes into file /tmp/test.out below:
5
%cat /tmp/test.out
Copied!
01234
​
Last modified 1yr ago
Copy link