python - Use IOSTREAM instread of file in Pygmentize -
i have following in python script: what try is read partial source code(e.g. line 20 line 40) buffer , pip/apply iostream pygmentize can generate code highlighting partial source code.(e.g. line 20 line 40) currently, create partial tmp file partial source code(e.g. line 20 line 40) , use tmp file on pygmentize . subprocess.call(["pygmentize", "-f", "html", "-o", htmlfile, tmpfilename]) tmpfilename file name code want highlight. my question: how can create iostream , pip/apply iostream pygmentize don't have create tmp file in /tmp directory any suggestion appreciated!