Biến toàn cục

Các biến toàn cục sau đây có sẵn trên toàn cầu.

  • Giao diện Python toàn cầu.

    Bạn có thể nhập các mô-đun Python và truy cập các kiểu và hàm dựng sẵn của Python thông qua biến toàn cục Python .

    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.
    

    Tuyên ngôn

    public let Python: PythonInterface