---
title: "Discussion on \"Filtering Dictionary In Python 3\" | Hashnode"
description: "Discussion on \"Filtering Dictionary In Python 3\". “RuntimeError: Dictionary changed size during iteration”, Python slaps you in your face when you try to add/remove entries in dict object during iteration.\nIn this post, I will walk us through how we can filter a dict collection. First, let us try to..."
url: "https://hashnode.com/posts/filtering-dictionary-in-python-3/5d359b2da068f6a76a2e6932"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Filtering Dictionary In Python 3](https://melvinkoh.me/filtering-dictionary-in-python-3?utm_source=hashnode&utm_medium=feed)

“RuntimeError: Dictionary changed size during iteration”, Python slaps you in your face when you try to add/remove entries in dict object during iteration. In this post, I will walk us through how we can filter a dict collection. First, let us try to...

Jul 22, 2019 · melvinkoh.me  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#data-structures](https://hashnode.com/tag/data-structures)

## Written by

[Melvin](https://hashnode.com/@melvinkcx)

@melvinkcx · 🌎

  
[View profile](https://hashnode.com/@melvinkcx)

Software Engineer

## Responses 1

Markdown supported · ⌘↵ to post

[Seth Livingston](https://hashnode.com/@sethl)

[Jul 22, 2019](https://hashnode.com/posts/filtering-dictionary-in-python-3/5d359b2da068f6a76a2e6932/comment/5d35bcc0297273767a1a1740)

Try the same operation using a _dict comprehension_; I think you'll like the result. :)
