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
Television
Parliament On Demand, Live TV, New Zealand.
Welcome to Parliament on Demand, the home of Parliament TV and all of New Zealand Parliament's...
By Nikolai Pokryshkin 2022-11-11 19:47:53 0 26K
Социальные проблемы
12 разгневанных мужчин. 12 Angry Men. (1957)
Юношу обвиняют в убийстве собственного отца, ему грозит электрический стул. Двенадцать присяжных...
By Nikolai Pokryshkin 2022-10-30 21:11:46 0 46K
Personal Finance
What’s Included in the Cost of Education?
What’s Included in the Cost of Education? Understanding Tuition and the Many Hidden Costs...
By Leonard Pokrovski 2025-10-30 22:32:55 0 4K
Business
How Does Viral Growth Work or What Drives It?
Viral growth is often described as the “holy grail” of scaling businesses. Instead of...
By Dacey Rankins 2025-09-17 10:45:24 0 4K
Money
Should I Pay Off My Credit Card or Save?
Should I Pay Off My Credit Card or Save? Deciding whether to pay off credit card debt or focus...
By Leonard Pokrovski 2025-09-22 19:43:56 0 5K

BigMoney.VIP Powered by Hosting Pokrov