One - One Code All

Blog Content

python 获取js控制台输出

Python   2011-12-24 22:04:48
from subprocess import Popen, PIPE

script = '''
console.log('hello world');
'''

p = Popen(['node'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
out, err = p.communicate(script.encode())
print(f'{out}\n{err}\n')



上一篇:python中numpy数组转置
下一篇:张三丰注吕祖《百字铭》

The minute you think of giving up, think of the reason why you held on so long.