Using python heredoc to substitute the external file read by python script.

Hongyi Zhao hongyi.zhao at gmail.com
Mon Mar 28 04:07:49 EDT 2016


Hi all,

See the following python codes:

import os
from subprocess import check_output

# POSIX: name shall not contain '=', value doesn't contain '\0'
output = check_output("source /home/werner/env-intel-toolchains.sh;
         env -0", shell=True, executable="/bin/bash")


In the above codes, I use the file /home/werner/env-intel-toolchains.sh 
for subprocess.check_output to use for its operation.

If I want to use python heredoc to substitute this external file for the 
above codes.  Is this possible?  

Regards
-- 
.: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.



More information about the Python-list mailing list