Python Slice Object

0
4K

A slice object is used to specify how to slice a sequence. You can specify where to start the slicing, and where to end. You can also specify the step, which allows you to e.g. slice only every other item. Here's an example of the usage:

x = ("hi", "hello", "greetings", "hola")

y = slice(3)

print(x[y])

 

>> ("hi", "hello", "greetings")

Buscar
Categorías
Read More
Programming
PEP8 Quick Tip
When indenting, use tabs instead of spaces. Yes, PEP8 does tell you that spaces are suggested for...
By Jesse Thomas 2023-02-09 22:47:21 0 4K
Nature and Science
Blackfish (2013)
A documentary following the controversial captivity of killer whales, and its dangers for both...
By Leonard Pokrovski 2023-07-14 18:39:19 0 21K
Искусство, культура и развлечения
Шерлок младший. Sherlock Jr. (1924)
Б.Китон - киномеханик, который мечтает быть знаменитым детективом, как Шерлок Холмс. Влюбленный в...
By Nikolai Pokryshkin 2023-04-02 21:01:16 0 30K
Жизненные вопросы
Вверх. Up. (2009)
78-летний ворчун Карл Фредриксен считает, что жизнь обходит его стороной. Чтобы сдержать...
By Nikolai Pokryshkin 2023-01-26 09:12:26 0 22K
Men's Health
Men's Health: Why Do Some Men Find It Difficult To Talk About Their Problems And Illnesses?
One of the main reasons why men find it difficult to discuss their health and problems is...
By Dacey Rankins 2024-04-17 14:07:45 0 7K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov