| 1 | initial version |
sage: s = str(2^1000)
sage: f = open('filename.txt', 'w')
sage: f.write(s)
sage: f.close()
| 2 | No.2 Revision |
or using a with-statement which closes the file for you:
sage: with open('filename.txt', 'w') as f:
....: f.write(str(2^1000))
| 3 | No.3 Revision |
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))
| 4 | No.4 Revision |
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))
| 5 | No.5 Revision |
:
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))
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.