Get Sage output on Python 2.7 without writing files [closed]
I have python 2.7 codes and I know that a random python cannot use sage as a python library. So I made a script .sage in python 2.7 and ran check_output command as follows.
from subprocess import check_output def sage_code_run(var) file = open("/path/to/file.sage", 'w') data = "sage codes with input %s" % var file.write(data) file.close() return check_output(["sage", "file.sage"])
It works well, but it makes delay because of writing files. And I know "sage -python", but it's not for 2.7. Is there a way to get sage output on python?