전역 변수

다음 전역 변수는 전역적으로 사용할 수 있습니다.

  • 전역 Python 인터페이스.

    Python 모듈을 가져오고 Python 전역 변수를 통해 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.
    

    선언

    public let Python: PythonInterface