Skip to content

Instantly share code, notes, and snippets.

@MattOates
Last active February 26, 2020 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattOates/8011900f2d1cc99a49be500270b01a73 to your computer and use it in GitHub Desktop.
Save MattOates/8011900f2d1cc99a49be500270b01a73 to your computer and use it in GitHub Desktop.
things = {"hi":10,"bye":3}
def flatten_counter(counter):
for value, count in counter.items():
for i in range(count):
yield value
print(list(flatten_counter(things)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment