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

216
Vistas
How to access an array from a javascript file in a python file

Im building a Spotify application with javascript and react, Ive managed to get a Spotify user's playlists and I have the user select two of those playlists which get put into two different arrays.

var playlist1 = [];
var playlist2 = [];

Inside these arrays there contains all the Spotify playlist data like its id, uri, tracks, etc. What Im trying to do is access these arrays in my python file and apply a recommendation algrotihms to create a playlist based on those two playlists. How would I go about accessesing these arrays in python? Thanks for any help :)

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There are two main ways of doing something like this (fairly) easy.

  1. All local:

If you want your app to stay local, just use text files to handle the data. A nice format that both languages can interpret is JSON. So, in your JS, write the data to a text file and then read that textfile in Python.

Above does not really makes sense when using react, since it is really web based. so I would recommend step 2:

  1. Client-server model:

Since you are using React, it is logical to build a client-server model where you use a REST-API (or socket etc.) to send and receive the data to both programs. Then, you can just send the data in JSON format by calling a POST to the rest-api that is hosted by your Python application with the JSON array containing the spotify information.

about 4 years ago · Juan Pablo Isaza Denunciar
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