This article is an example of Python list counting and insertion usage. Shared for your reference. Specific as follows:
Copy Code The code is as follows.
word=['a','b','c','d','e','f','g']//first element is element 0, word[0]=a
a=[num1:num2]
// elements from num1 to num2 (excluding element num2)
//If negative, it represents the penultimate number
a=[num1:num2]
// elements from num1 to num2 (excluding element num2)
//If negative, it represents the penultimate number
When operating on a list, append appends, (elements)
Elements are independent, and are appended to the word as a whole if it is a list, rather than extending the word.
(elements) is extended, the elements contained in elements will be extended after the word insert(), insert:
Copy Code The code is as follows.
(mum,elements)
What is inserted is also is also a whole.
I hope that what I have described in this article will help you in your Python programming.