Issue
I'm working on Jupyter Notebooks and I'd like to write the value of a Python string variable into a Markdown heading. I'm well aware that one can write, in a Markdown cell,
# Python
a = 'hello'
In a markdown cell, a is {{a}}
and this works for me, but I'm trying to do something like
# This is a heading with {{a}} in it
But the last attempt didn't work. I googled a little bit, but I couldn't find anything. Any help will be appreciated. Thanks in advance!
Solution
This works for me, but it is just a code cell; so it might not be the exact functionality you want...
from IPython.display import Markdown as md
a = 'hello'
md("# The data consists of {} observations. Bla, Bla, ....".format(a))
Answered By - Mason Caiby
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.