python 如何自动补全?

class test_c :
    a =1

box =[]

for i in rang(100):
    test = test_c()
    box.append(test)


for node in box :
    在这里的node ,为test_c类型,但是没有办法自动补全在VSCODE中,
    有什么办法能让VSCDOE知道这里的node是test_c类型?
阅读 1.2k
1 个回答
新手上路,请多包涵

使用 python 的 typing 库。

import typing as T

class test_c :
    a =1

box: T.List[test_c] =[]

for i in rang(100):
    test = test_c()
    box.append(test)


for node in box :
    print(node.
    # 自动补全 a
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题