在Jupyter Notebook Markdown单元Python中打印变量 [英] Print Variable In Jupyter Notebook Markdown Cell Python

查看:805
本文介绍了在Jupyter Notebook Markdown单元Python中打印变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在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来解决问题:

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

已采取的步骤:

  1. pip安装jupyter_contrib_nbextensions
  2. jupyter贡献nbextension install --user
  3. 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中打印变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆