I like the way Jupyter extension is built on VSCode, but I haven't get it to run a cell of my choise.
My question is: Is there a way to select which line gets executed or is it always the last in the file?
Right now I just put each output providing cell to separate file and import required features, but quick iterative experiments would be handy just to quickly write on the same file.
It looks like #%% begins a cell so there are two ways of doing this I think:
#%%
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
#%%
x = np.linspace(0, 20, 100)
plt.plot(x, np.sin(x))
plt.show()
and you can run each cell separately (or line - wherever you place the #%%) Run cell will pop up above the line you put this on.
Or install code-runner: code-runner . For more info see here: Jupyter-IPython and here Getting Started
EDIT: Just found another way from the last hyperlink:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.