0Pricing
Mojo Academy · Lesson

Moving Data Across the Bridge

Convert between Mojo and Python values.

Two Worlds of Values

Mojo has its own native types, and Python has its own. Interop means converting values as they cross between the two worlds.

Mojo to Python

When you pass a Mojo value into a Python call, Mojo automatically wraps it into a PythonObject Python can understand.

var n: Int = 42
print(np.sqrt(n))

All lessons in this course

  1. Importing a Python Module
  2. Calling Python Functions
  3. Moving Data Across the Bridge
  4. When to Use Python Interop
← Back to Mojo Academy