问题描述
我可以在Markdown Cell Jupyter Notebook中打印变量的值吗?
Can I print the value of a variable in Markdown Cell Jupyter Notebook?
尝试代码:
value = 5.3
Markdown cell --> Value is {{ value }}
我希望Markdown单元格显示变量的值
I want that the Markdown cell should display the value of variable
SCREENSHOT
推荐答案
因此,在浏览了所有链接之后,我可以通过参考nbextension jupyter notebook docs来解决问题: https://github.com/ipython-contrib/jupyter_contrib_nbextensions
So After going through all the links I was able to resolve the problem by referring to nbextension jupyter notebook docs : https://github.com/ipython-contrib/jupyter_contrib_nbextensions
已采取的步骤:
- pip安装jupyter_contrib_nbextensions
- jupyter贡献nbextension install --user
- jupyter nbextension启用python-markdown/main
上述命令启动jupyter笔记本并在markdown单元格中打印变量的值后,就像魅惑一样!
After the above commands started a jupyter notebook and to print the value of a variable in the markdown cells works like charm!
您只需要在降价单元格中使用 {{ac_score}} .
You just have to use {{ ac_score }} within a markdown cell.
屏幕截图
谢谢!
这篇关于在Jupyter Notebook Markdown单元Python中打印变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!