Given the following Python code
a = 3 # only this variable is going to be renamed by hand
A = 3
abc = 3
a += 1
I want to rename all occurrences of the variable "a" to "b" automatically so that the result looks like this
b = 3 # variable was renamed from a to b manually
A = 3 # variable was not affected by the renaming
abc = 3 # variable was not affected by the renaming
b += 1 # variable was renamed from a to b automatically
Notice that I just want to rename the variables in the current module, nowhere else!
At the moment, to do this I am doing the following steps (Pycharm 2018.3.3 (Community Edition)):
Shift+F6 and make sure that the checkboxEnter to refactor.
The problems with this method are:
With this being said, my final question is: Is there a way to rename variables that is fast regardless of the variable name and only takes place in the current module?
You can edit it using the refactor tool in Pycharm. Click on the variable and press shift+F6.

Type the name and press Enter.
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