1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to NoSQL

Connected

Exercise

Retrieving key-value data with Redis

Now that you've practiced storing key-value pairs with Redis and Python, it's time to explore the other half of that process: retrieving key-value pairs. In this example, you'll practice retrieving a few different key-value pairs that you might find in a web application built to report on weather data.

A connection object has been created and stored in the variable redis_conn. Enjoy!

Instructions

100 XP
  • Use the redis_conn variable and the appropriate method to try and parse the temperature for each city in the list of cities from Redis.
  • If the temperature value is None for the passed key, set "unknown temperature" as the value for that key, and print a short message.