From the course: Effective Serialization with Python

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

YAML serialization

YAML serialization - Python Tutorial

From the course: Effective Serialization with Python

Start my 1-month free trial

YAML serialization

- [Instructor] The YAML format is textual and very readable. It has comments and supports a wide variety of types, which makes it ideal for configuration. Let's have a look. The nice thing about YAML, that it has references. You can define a value once, and then reference it, in other places in the documents, avoiding copy and paste errors. So in our case, we define the API host, with an anchor called API host for app.example.com. Then we have the authentication server configuration, which references the API host and listens on port 88. The database server, which has a host, a port, a user, and a password. And a log server, which has again, a reference to the API host, it listens on a different port, eight, eight, eight, eight, and the endpoint is slash log. YAML is not in the Python standard library. You will need to install it. So, python-m pip install, and pyyaml. And once it's there, we can start using it. So…

Contents