0Pricing
Mojo Academy · Ders

Mojo Verilerini Python'a Aktarma

Değerleri birlikte çalışabilirlik köprüsü üzerinden aktarın.

Mojo Verilerini Python'a Aktarma, CoddyKit'te ücretsiz bir Mojo Academy dersidir. Bu, 4 dersinin 2. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Mojo Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Mojo Academy kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Crossing the Bridge

To use a Python library, your Mojo values must cross into Python first. That hand-off is the heart of interop. 🌉

Numbers Convert

Mojo numbers turn into Python numbers automatically when you pass them. A Mojo Int becomes a Python int the library can read.

var n = 42
var result = np.array([n])

Build Python Lists

Many NumPy calls expect a Python list. You can write the list literal right inside the call, and Mojo passes it across the bridge.

var a = np.array([1, 2, 3, 4])

The PythonObject Type

On the Python side, everything is a PythonObject. It is Mojo's wrapper for any value living in the Python world.

var obj: PythonObject = 3.14

Wrap a Value

Annotate a value as PythonObject to convert it for Python. Mojo handles turning your number into the matching Python type.

var py_x: PythonObject = 10

Strings Cross Too

Mojo strings convert into Python strings the same way, so you can pass text labels and names straight into Python functions.

var name: PythonObject = "mojo"

Pass as Arguments

Once converted, just hand values to a Python call as arguments. The library receives normal Python objects and works as usual.

var scaled = np.multiply(a, 2)

Mark It raises

Conversions and Python calls can fail, so wrap this work in a function marked raises to stay safe.

fn send() raises:
    var py_x: PythonObject = 5

Mind the Copy

Crossing the bridge often copies data into Python's memory. That copy has a cost, so pass big buffers thoughtfully.

Lists of Numbers

You can also pass a Mojo list of values into Python. Each element converts as it crosses, arriving as a Python list.

var data = [1.0, 2.0, 3.0]
var arr = np.array(data)

Why It Matters

Smooth conversion means your Mojo numbers and text flow into any Python library, letting you reuse powerful tools without friction. ✨

Quick Check

Recall the type that represents a value once it lives on the Python side.

Recap

You saw Mojo numbers and strings convert into PythonObject values, ready to pass as arguments into any Python call across the bridge. 🎯

Sıkça Sorulan Sorular

“Mojo Verilerini Python'a Aktarma” dersi ücretsiz mi?

Evet — “Mojo Verilerini Python'a Aktarma” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Mojo Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Mojo Academy kursu toplamda 4 dersten oluşur.

“Mojo Verilerini Python'a Aktarma” dersinde ne öğreneceğim?

Değerleri birlikte çalışabilirlik köprüsü üzerinden aktarın. Mojo Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Mojo Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Mojo Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 2. dersidir.

“Mojo Verilerini Python'a Aktarma” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Mojo Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Mojo Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Mojo'dan NumPy Kullanma
  2. Mojo Verilerini Python'a Aktarma
  3. Python Nesnelerini Geri Okuma
  4. Birlikte Çalışabilirlik Performansı Tuzakları
← Mojo Academy Sayfasına Dön