Google colab change variable name everywhere in code cell

Viewed 1862

When I highlight a variable within a cell in colab, all the instances of that variable shines up.

enter image description here

Is it possible to change all these instances of the variables at the same time and if such, how?

1 Answers

Google colab uses the same keys short-cuts of microsoft VS, just use Ctrl+D to add to the selection the next occurrence.

Use instead Ctrl+Shift+L to select all occurrence.

Once you selected the occurrences you can edit them by just typing the new name.

If you use short variable names ( as X) this method will probably not work, as every word with an x in it will also change.

Related