0 votes
in Python Flask by
What is slicing?

1 Answer

0 votes
by
Slicing is a technique that allows us to retrieve only a part of a list, tuple, or string. For this, we use the slicing operator [].

>>> (1,2,3,4,5)[2:4]
(3, 4)

>>> [7,6,8,5,9][2:]
[8, 5, 9]

>>> 'Hello'[:-1]
‘Hell’
...