Ask Your Question

Revision history [back]

sage: s = str(2^1000)
sage: f = open('filename.txt', 'w')
sage: f.write(s)
sage: f.close()

sage: s = str(2^1000) sage: f = open('filename.txt', 'w') sage: f.write(s) sage: f.close() f.close()

or using a with-statement which closes the file for you:

sage: with open('filename.txt', 'w') as f:
....:     f.write(str(2^1000))

sage: s = str(2^1000) sage: f = open('filename.txt', 'w') sage: f.write(s) sage: f.close()

or using a with-statement which closes the file for you:

sage: with open('filename.txt', 'w') as f:
....:     f.write(str(2^1000))

sage: s = str(2^1000) sage: f = open('filename.txt', 'w') sage: f.write(s) sage: f.close()

or using a with-statement which closes the file for you:

sage: with open('filename.txt', 'w') as f:
....:     f.write(str(2^1000))

:

sage: s = str(2^1000)
 sage: f = open('filename.txt', 'w')
 sage: f.write(s)
 sage: f.close()

f.close()

or using a with-statement which closes the file for you:

sage: with open('filename.txt', 'w') as f:
....:     f.write(str(2^1000))