Is there a keyboard shortcut in Pycharm for renaming a specific variable?

爱⌒轻易说出口 提交于 2019-12-03 06:24:38

Highlight your old_name and hit Shift+F6

I don't know about a shortcut for this special purpose, but I simply use Ctrl+R to replace the old variable names with new ones. You can also set settings such as Match case, Regex or In selection.

Note that this won't work, if you have a variable name including another variable name:

var1 = 0
var1_s = "0"

Replacing var1 to xy would result in :

xy = 0
xy_s = "0"

But that also forces you to do consistent and clear variable naming.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!