bundles / IPython 9.18.0.dev / IPython / utils / io / temp_pyfile
function
IPython.utils.io:temp_pyfile
source: /IPython/utils/io.py:112
Signature
def temp_pyfile(src: str, ext: str = .py) → strSummary
Make a temporary python file, return filename and filehandle.
Parameters
src: string or list of strings (no need for ending newlines if list)Source code to be written to the file.
ext: optional, stringExtension for the generated file.
Returns
: (filename, open filehandle)It is the caller's responsibility to close the open file and unlink it.
Aliases
IPython.utils.io.temp_pyfile