Search code examples
pythongoogle-colaboratoryshortcut

Changing same word in code at the same time with google colab


I'm using colab to work on python projects and was wondering if there was a way to highlight a certain text and change that text for all of the other places in the code. Example:

variable = 1
variable2 = variable + 1

And then change variable to var without having to individually change every single line

var = 1
var2 = var + 1

Solution

  • You could use Find and Replace on the Edit tab. Another useful trick is clicking in every place you want to edit while pressing alt and you have multiple text cursors editing at the same time.