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.out

01234

Last updated