Output to a file
Output to a file:
with open('/tmp/test.out','w') as fp:
    for i in range(5):
        fp.write(str(i))
#It writes into file /tmp/test.out below:
%cat /tmp/test.out01234
Last updated
Was this helpful?
with open('/tmp/test.out','w') as fp:
    for i in range(5):
        fp.write(str(i))
#It writes into file /tmp/test.out below:
%cat /tmp/test.out01234
Last updated
Was this helpful?