BaşlayınÜcretsiz Başlayın

Storing Python dictionaries with Redis

In addition to storing simple key-value pairs, you can store more complex Python data types, such as dictionaries. In this final exercise with Redis, you'll practice storing and retrieving Python dictionaries with the help of the redis module in Python.

Similar to before, a connection object has been created and stored in the variable redis_conn. Good luck!

Bu egzersiz

Introduction to NoSQL

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Using the redis_conn variable, store the dictionary london_weather_mapping to the "london_weather" key.
  • Retrieve and print the "london_weather" key-value pair using the redis_conn variable and the appropriate method.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create a dictionary containing weather data
london_weather_mapping = {
	"temperature": 42,
	"humidity": 88,
	"visibility": "low"
}

# Store the london_weather key-value pair
____.____(
    "____",
	mapping=____
)

# Retrieve and print the london_weather key-value pair
print(____.____("____"))
Kodu Düzenle ve Çalıştır