How to use jupyter_client to get the execute resul

2019-08-03 21:19发布

I'd like to use jupyter_client to execute some python code and get result. Here's my sample code. But I could not get the output hello world, Could anyone help me ? Thanks

import jupyter_client
kernel_manager, kernel_client = jupyter_client.manager.start_new_kernel(kernel_name='python3')
kernel_client.execute("print('hello world')")
kernel_client.get_shell_msg() 

1条回答
可以哭但决不认输i
2楼-- · 2019-08-03 21:51

The output wont be on the standard output, it will be in a result object. Check this snippet: https://www.snip2code.com/Snippet/1169700/sample-code-for-jupyter_client

查看更多
登录 后发表回答