显示字符串中的astropy数量

2024-04-23 08:03:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在寻找一种方法来呈现IPython笔记本中LaTeX字符串中的astropy变量。例如,给定一个简单的前提

from astropy.constants import c
import astropy.units as u
from astropy import log

光速默认渲染为:

latex-rendering

只需在ipython提示符中输入它。现在,如果我想把它嵌入一个字符串呢?如何跳到astropy已经使用的同一个呈现序列上,以打印像'Speed limit: {}'.format(c)这样的示例字符串?你知道吗

到目前为止,我尝试的所有方法,包括LaTeX格式字符串的变体,都只将ASCII字符串显示为输出: ascii-rendering


Tags: 方法字符串fromimportlogasipython笔记本