Python tip 8: dict.fromkeys() method

Publicado em: 30 Março 2022
no canal de: learnbyexample
828
17

A lesser known way to create a dictionary is to use the `fromkeys()` method that accepts an iterable and an optional value (default is `None`).

Recent Python versions ensure that the insertion order is maintained for a dictionary. So, you can remove duplicate items from a list while maintaining the order by building a dictionary using the `fromkeys()` method and converting it back to a list.

This video is based on content from my "100 Page Python Intro" ebook: https://github.com/learnbyexample/100...


Nesta página do site você pode assistir ao vídeo on-line Python tip 8: dict.fromkeys() method duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário learnbyexample 30 Março 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 828 vezes e gostou 17 espectadores. Boa visualização!