How python uses the enumerate () function
Editor to share with you how python uses the enumerate () function, 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!
Enumerate ()
Enumerate (): this function takes a collection (for example, tuples) and returns it as an enumeration object.
X = ["Zhang San", "Li Si", "Wang Wu"] for index, value in enumerate (x): print (f "my name is {value}, my index in the list is {index}")
The results are as follows:
These are all the contents of the article "how python uses the enumerate () function". 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!