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

Search
Categories
Read More
Телевидение
Вести Хакасия. ТВ прямой эфир.
В настоящее время филиал ВГТРК ГТРК «Хакасия» является структурным подразделением...
By Nikolai Pokryshkin 2022-10-24 10:03:37 0 29K
International
Embracing Internationality: Fostering Global Citizenship Among Kids and Teens
Embracing Internationality: Fostering Global Citizenship Among Kids and Teens In an increasingly...
By Leonard Pokrovski 2024-04-30 15:02:04 0 28K
Financial Services
Law of supply
Key points The law of supply states that a higher price leads to a higher...
By Mark Lorenzo 2023-04-07 20:57:24 0 13K
Marketing and Advertising
What Are the Risks of Launching a New Product (and How to Avoid Them)?
Launching a new product can be one of the most exciting — and dangerous — moments for...
By Dacey Rankins 2025-10-29 16:09:44 0 6K
Social Issues
Casino. (1995)
A tale of greed, deception, money, power, and murder occur between two best friends: a mafia...
By Leonard Pokrovski 2023-02-11 19:54:34 0 26K

BigMoney.VIP Powered by Hosting Pokrov