Python-进口上的百分比符号

发布于 2025-01-29 04:48:14 字数 691 浏览 0 评论 0原文

我正在关注此 tutorial 我尝试过复制该第一个示例的代码。 这是示例上的第一行:

from PIL import Image
import random
import time
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow, show
import matplotlib.animation as animation

#this is crucial to animation in matplotlib
%matplotlib notebook
.
.
.

如您所见,在导入下方,有此行%matplotlib笔记本。这条线引起了问题,因为它没有被识别为命令。
这是问题描述:陈述期望,找到PY:PERCextent of语句预期

我的问题是 - 在这种情况下,百分比符号的含义是什么?它可以工作吗?

I'm following this tutorial and I've tried to copy the code of the first example.
this is the first lines on the example:

from PIL import Image
import random
import time
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow, show
import matplotlib.animation as animation

#this is crucial to animation in matplotlib
%matplotlib notebook
.
.
.

As you can see, right underneath the imports, there is this line %matplotlib notebook. this line is causing a problems because it doesn't recognized as a command.
this is the problem description: Statement expected, found Py:PERC and End of statement expected

My question is - what is the meaning of the percentage symbol in this case and why doesn't it work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凡间太子 2025-02-05 04:48:14

该语法是jupyter笔记本公约。如果您不使用Jupyter笔记本,则可以删除此行。

This syntax is a Jupyter notebook convention. If you are not using Jupyter notebook, then you can probably remove this line.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文