Variáveis ​​globais

As seguintes variáveis ​​globais estão disponíveis globalmente.

  • A interface global do Python.

    Você pode importar módulos Python e acesso Python embutido tipos e funções através do Python variável global.

    import Python
    // Import modules.
    let os = Python.import("os")
    let np = Python.import("numpy")
    
    // Use builtin types and functions.
    let list: PythonObject = [1, 2, 3]
    print(Python.len(list)) // Prints 3.
    print(Python.type(list) == Python.list) // Prints true.
    

    Declaração

    public let Python: PythonInterface