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

227
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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