【问题标题】:Can Pycharm autocomplete the left side of an assignment operator like eclipse?Pycharm可以自动完成像eclipse这样的赋值运算符的左侧吗?
【发布时间】:2019-04-30 06:19:17
【问题描述】:

Pycharm 能否自动完成赋值运算符的左侧,例如 eclipse can with ctrl+shift+L

假设我有一个函数,例如:

def file_list(self, pattern=None):
    ...
    return matching_filenames

我在别处输入/自动完成以下代码 sn-p 以使用该功能:

self.file_list(pattern)

PyCharm 能否自动完成如下:

matching_filenames= self.file_list(pattern)  // or even
file_list = self.file_list(pattern)

怎么样?

我在 PyCharm 文档中找不到任何内容:

https://www.jetbrains.com/help/idea/auto-completing-code.html https://www.jetbrains.com/help/pycharm/mastering-keyboard-shortcuts.html

我知道 Eclipse 可以做到这一点,PyCharm 可以吗?

【问题讨论】:

    标签: python-3.x ide pycharm


    【解决方案1】:

    是的,可以。 默认选项应该是:

    1. 选择self.file_list(pattern)(标记)
    2. 点击Ctrl + Alt + V 它应该在您的代码中添加一个新变量。

    link for JetBrains's Pycharm documentation about this shortcut

    旁注:有很多有用的快捷方式和称为实时模板的东西。我建议您阅读这两篇文章,因为它们可以帮助您更快地编写代码,并且这样做会让您看起来更酷。

    【讨论】:

      猜你喜欢
      • 2015-01-20
      • 1970-01-01
      • 2015-06-12
      • 2017-07-16
      • 2016-06-08
      • 2016-08-20
      • 2023-04-10
      • 2021-12-17
      相关资源
      最近更新 更多