Maxximiliann

Maxximiliann

Converting an Elixir list into a Python dictionary

What libraries, if any, can be used to take an Elixir list: [color: "Red", make: "Mclaren", mileage: 15641.469] and convert into a Python dictionary - {"color": "Red", "make": "Mclaren", "mileage": 15641.469}?

If no such libraries exist, what approach would you recommend to accomplish this efficiently?

Most Liked

hauleth

hauleth

What you mean by “convert”? If you want to send it to the other program then you need to serialise it into some format understood by the both parties and then send it. For example you can use JSON, BARE, ProtoBuf, bencode, ETF, Cap’n’proto or almost any other format out there.

gregvaughn

gregvaughn

That python example looks like json

iex(2)> [color: "Red", make: "Mclaren", mileage: 15641.469] |> Map.new |> Jason.encode!
"{\"color\":\"Red\",\"make\":\"Mclaren\",\"mileage\":15641.469}"
aenglisc

aenglisc

You could probably look for some ETF library for Python. Not sure if there are any though.

Where Next?

Popular in Discussions Top

AlexMcConnell
The reason that Rails is as popular as it is is because it’s very easy for relatively inexperienced developers to get a lot of work done....
588 20070 166
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
nburkley
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
New
eteeselink
Hi all, In the last days, two things happened: A blog post titled “They might never tell you it’s broken” made the rounds. It’s about ...
New
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New
cvkmohan
The upcoming Phoenix 1.6 release looks very interesting. Became a habit to watch the commits - and - what they are bringing in. phx.gen...
New
arcanemachine
https://nitter.net/josevalim/status/1744395345872683471 https://twitter.com/josevalim/status/1744395345872683471
New

Other popular topics Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49134 226
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44167 214
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement