What does an index mean in python?

Perhaps this sounds like a dumb question. However, I need to find out what an index is because I want to learn python.

For example, on a website, I saw this:

The find () method determines whether str exists in a string or in a substring of a string if the starting index and the end of the end of the index are given.

http://www.tutorialspoint.com/python/string_find.htm

What does "index" mean here? I would like you to explain this to me as if you were explaining something to the child. Because my understanding is somewhat poor. Anyway. You can even give examples to explain what an index is.

Many thanks.

+4
source share
4 answers

. Python ; ( ) ( ).

"Python" :

P y t h o n
0 1 2 3 4 5

, Python , . , -1, - -2 ..:

 P  y  t  h  o  n
-6 -5 -4 -3 -2 -1

. , find -- , :

"Python".find("y", beg=1, end=-2)
+5

"index" "".

find(): find() . beg end. beg end. ( ) beg 0 ( , ), end - ( , ). , - ( , , ).

+6

"Hello". , e, , . python . , e "Hello" 1.

:

print "Hello".find("e");

1.

, , . "e" "H", -, "Hello".

+4

, . Python .

Python ( 3) ( ), ( 255, .. ), ( ) ( ). ; , , () .

a - (.. ), a[0] , a[1] .. ( ), mutable. (, , ), .

lst[0] = 3, , print(s[3]).

For lists and tuples, items are not stored directly inside the array. Only references to targets are stored internally. The object-object gets access indirectly (one jump on the link). Think that you are going to an indexed house, and the person inside tells you where the real content is (in another house, not on this street). In this case, even an element from the (immutable) set, for example, t[5]i.e. link - can be used to modify the contents of the target ... if the target is modified.

+3
source

All Articles