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.3k
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
推荐问题