How python maps objects to unique counting numbers
Editor to share with you how python maps objects to unique counting numbers, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Map objects to a unique count number (collections.defaultdict)
> > import itertools, collections > value_to_numeric_map = collections.defaultdict (itertools.count () next) > value_to_numeric_map ["a"] 0 > value_to_numeric_map ["b"] 1 > > value_to_numeric_map ["c"] 2 > value_to_numeric_map ["a"] 0 > value_to_numeric_map ["b"] 1 is all the contents of this article "how python maps objects to unique counting numbers". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!