problem description
get the results returned by system command execution through popen, but encountered some command execution failures in the process. Instead of returning to the py variable as expected, the output is printed directly. The following example is accompanied by the execution result
.the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)
< H1 >! / usr/bin/python < / H1 > import os
t = os.popen ("dir"). Read ()
t = os.popen ("wjwdidjiwwdhijiwd"). Read ()
exit (1)
what result do you expect? What is the error message actually seen?
python test.py
expect nothing, but actually see
sh: wjwdidjiwwdhijiwd: command not found
excuse me, why is this?
has been resolved, although it is an error, but in fact there is no output. no, no, no.