Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

264
Vistas
How to pass an array as an argument to javascript function calling from python using js2py?

I have written some really long functions in javascript already, and now I want to utilise and can't write them again in python, but the data I'm receiving is from python code. So I'm translating the javascript code into python using js2py.translate_file. The data is in a matrix format, so after translating the js file, while I make a call to a function how do I pass the matrix from py file and how do I receive it in the js function?

I know it will be easy to just write the function in py file instead, but I had already written it in js and now I'm desperate to use it from js file, Please help me get this...

This is the code in the py file.

import js2py

js2py.translate_file("j_script.js", "my4.py")
from my4 import *
my4.get_data(mat)

This is the function in the js file that will receive the data.

function get_data(grid_wise){
    
    for(var bi=0; bi<9; bi++){
        for(var ni=0; ni<9; ni++){
            new_new_matrix[bi][ni]=grid_wise[bi][ni];  
        }
    }
    for(var bi=0; bi<9; bi++){
        for(var ni=0; ni<9; ni++){
            reassign(bi, ni);
        }
    }
    console.log(mat_row_wise);
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda