Is there a way to rename a variable everywhere in your current jupyter notebook file?
I.e. let's say my notebook referencing a variable "foo" in multiple functions and locations through my script. Later I decide I want to rename this variable to "bar" for better readability...
In xcode, you can highlight and right click to do this. Sort of a smart search/replace command.
Would love to be able to do the same thing.
Thanks!
The normal keyboard shortcut (including python's IDLE) for this is Ctrl+H , though different editors have different shortcuts. Show activity on this post. In WingIDE you have the option via the Refactor Menu to do Rename Symbol.
To set an env variable in a jupyter notebook, just use a % magic commands, either %env or %set_env , e.g., %env MY_VAR=MY_VALUE or %env MY_VAR MY_VALUE . (Use %env by itself to print out current environmental variables.)
I hope you have already solved this. But, my answer will help someone who has similar problem like that. I think this can be accomplished using the Find and Replace option which can be found under the edit menu of the notebook. If you're in command mode, you can easily press the F key and bring up the find and replace dialog. Thank you!
Maybe a bit late, but I found a simple solution:
1 - shift+click in first cell 2 - shift+click in last cell 3 - Press F or go to Edit/Find and Replace 4 - Rename the expression you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With