How python uses collection and list statistics
This article mainly introduces python how to use collection and list statistics, the article is very detailed, has a certain reference value, interested friends must read it!
Use collection (set) and list (list) statistics
First use set to remove weight, and then loop each element and the corresponding number of times list.count (item) into tuples.
A: there are no answers to problems encountered in study. The editor has created a Python learning exchange group: 531509025 look for like-minded partners to help each other, and there are also good video learning tutorials and PDF e-books in the group! Lists = [count_set = set (lists) print (count_set) # assemble to get rid of # {1meme 2pje 3, 'baked,' a'} count_list = list () for i in count_set: count_list.append ((I, lists.count (I)) print (count_list) # [(1pc2), (2,1), (3pr 1), ('baked 1)] ('asides, 2)] these are all the contents of the article "how python uses Collection and list Statistics" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!