edn_format | EDN reader and writer implementation | Serialization library
kandi X-RAY | edn_format Summary
kandi X-RAY | edn_format Summary
Implements the EDN format in Python. All features of EDN are implemented, including custom tagged elements.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of edn_format
edn_format Key Features
edn_format Examples and Code Snippets
edn_format.dumps({'a': 1}, keyword_keys=True)
# => {:a 1}
edn_format.dumps({edn_format.Keyword('a'): 1})
# => {:a 1}
Community Discussions
Trending Discussions on edn_format
QUESTION
I'm trying to use EDN to communicate between a simple Python server and an in browser app written using ClojureScript.
So the server needs to generate and return chunks of EDN format for the browser.
I've installed https://github.com/swaroopch/edn_format which seems to be a recommended EDN library for Python.
But I want to be able to generate a map that uses Clojure symbols for keys. Eg. {:a 1 :b 2}
However, if I create a Python dictionary {"a":1, "b":2}
and pass it to the dumps function, the final EDN keeps the keys as strings, not symbols.
Obviously there are no :symbols
in Python. But is there a way to convince edn_format.dumps to turn dictionary string-keys into them? Or is there a better edn library for Python that can do this?
ANSWER
Answered 2018-Jun-22 at 22:10You can use the keyword_keys
argument:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install edn_format
You can use edn_format like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page