Is there a way to default to “Replace in all cells

2020-05-30 06:43发布

问题:

I usually want to find and replace all, but it looks like it has been set to current/highlighted cell only (https://github.com/jupyter/notebook/pull/2131). jupyter also doesn't remember the option after the dialog goes away. Is there a way to change this behavior? Thanks.

回答1:

Select all the cells where you want to perform Find/Replace

Shift + Arrow key Down or Up


and then,

Menu: Edit -> Find and Replace



回答2:

Press ctrl+shift+F. Then type "find and replace". In order to rename a variable in all cells, click on the arrow as shown in the image



回答3:

I just had to do it urgently so shut down the notebook kernel did it from the terminal with sed like this:

sed -i "" 's/oldword/newword/g' mynotebook.ipynb

That was on a mac which am using at the moment, but if you do it on ordinary linux the "" should be left out ie

sed -i 's/oldword/newword/g' mynotebook.ipynb

First time I ever needed to do such a thing in years but if it happened more often would be good if it could be done from the browser.