|   | 1 |  initial version  | 
Your question is not very clear. If you want to save the output in a text file named /tmp/file.py, you can do:
sage: with open('/tmp/file.py','w') as f:
....:     f.write(str(sage_input(m)))
If you want to append to an existing file, just replace 'w' with 'a'.
|   | 2 |  No.2 Revision  | 
Your question is not very clear. clear on where to copy the code.
If you want to save the output in a text file named /tmp/file.py, you can do:
sage: with open('/tmp/file.py','w') as f:
....:     f.write(str(sage_input(m)))
If you want to append to an existing file, just replace 'w' with 'a'.
If you want to copy the output in the clipboard so that you can paste it from the mouse to some window with CTRL+V, you can install clipboard Python module from a shell:
$ sage -pip install clipboard
an then do (in the Sage session):
sage: import clipboard
sage: clipboard.copy(str(sage_input(m)))
|   | 3 |  No.3 Revision  | 
Your question is not very clear on where to copy the code.
If you want to save the output in a text file named /tmp/file.py, you can do:
sage: m = random_matrix(ZZ,100,100)
sage: with open('/tmp/file.py','w') as f:
....:     f.write(str(sage_input(m)))
If you want to append to an existing file, just replace 'w' with 'a'.
If you want to copy the output in the clipboard so that you can paste it from the mouse to some window with CTRL+V, you can install clipboard Python module from a shell:
$ sage -pip install clipboard
an then do (in the Sage session):
sage: import clipboard
sage: clipboard.copy(str(sage_input(m)))
|   | 4 |  No.4 Revision  | 
Your question is not very clear on where to copy the code.
If you want to save the output in a text file named /tmp/file.py, you can do:
sage: m = random_matrix(ZZ,100,100)
sage: with open('/tmp/file.py','w') as f:
....:     f.write(str(sage_input(m)))
If you want to append to an existing file, just replace 'w' with 'a'.
If you want to copy the output in the clipboard so that you can paste it from the mouse to some window with CTRL+V, you can install clipboard Python module within Sage virtual environment from a shell:
$ sage -pip install clipboard
an then do (in the Sage session):
sage: import clipboard
sage: clipboard.copy(str(sage_input(m)))
 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.
 
                
                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.