Python Slice Object

0
11K

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")

Cerca
Categorie
Leggi tutto
История
Сокровища Сьерра-Мадре. The Treasure of the Sierra Madre. (1948)
В небольшом мексиканском городке Тампико знакомятся два бедняка Доббс и Кертин. От местного...
By Nikolai Pokryshkin 2023-02-19 18:34:14 0 22K
Science Fiction and Fantasy
Metropolis. (1927)
In a futuristic city sharply divided between the working class and the city planners, the son...
By Leonard Pokrovski 2023-01-29 15:36:07 0 21K
Elenco
1917. (2019)
April 6th, 1917. As an infantry battalion assembles to wage war deep in enemy territory, two...
By Leonard Pokrovski 2023-02-01 14:54:03 0 26K
Социальные проблемы
Аферистка. I Care a Lot. (2021)
Марла руководствуется принципом «побеждает сильнейший». Женщина организовала...
By Nikolai Pokryshkin 2022-09-15 20:38:31 0 35K
Business
How Do Content Creators Earn Money?
Content creation has transformed into a viable career path for millions of individuals, with...
By Dacey Rankins 2025-02-24 15:58:14 0 14K

BigMoney.VIP Powered by Hosting Pokrov