Kfir Ettinger
Kfir Ettinger

Reputation: 622

Python - percentage symbol on imports

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?

Upvotes: 1

Views: 1212

Answers (1)

Rivka strilitz
Rivka strilitz

Reputation: 46

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

Upvotes: 3

Related Questions