Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

267
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda