| 1 | initial version |
sage: promptsage -n jupytersage --pip install jupyterlabsage -n jupyterlabsage -n sagenbnotebook()sage -c sage -c "print(2 + 2)".py or .sage myfile.sage or myfile.pysage myfile.sage or sage myfile.py.sage and .py files
.sage files, the Sage preparser will be used.py files, the Sage preparser will not be usedload, runfile, attach, %load, %runfile, %attachmyfile.sage contains def sq(a): return a*asage -c "load('myfile.sage'); print(sq(2))"sage for the Sage REPLsage_select to select which version of Sage to use by default.sagews).ipynb)
rst2ipynb, ...! is executed as a shell command!:
ls, cd, pwd...os and sysread from file, all at once or line by line
with open('/path/to/file.txt', 'r') as f:
s = f.read()
with open('/path/to/file.txt', 'r') as f:
for line in f:
<do something with line>
write to file, bit by bit or line by line
with open('/path/to/file.txt', 'a') as f:
f.write('blah')
f.writelines(['haha', 'hehe', 'hihi'])
see also the csv module for "comma-separated-values" data files
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.