Python Slice Object
Posted 2023-02-27 22:23:14
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
- Arts
- Business
- Computers
- Games
- Health
- Home
- Kids and Teens
- Money
- News
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Read More
E-book (device)
E-book (device)
Electric book (reader, coll. "e-reader"; An e-book...
9 Best Android Emulators for PC and Mac
Why do I need an emulator?
Android emulators allow you to run smartphone apps and games on your...
How Did the Leader Develop Their Leadership Style or Philosophy?
A leader’s style rarely appears overnight. It evolves over time, shaped by experiences,...
How Do Startup Founders Pay Themselves?
As a startup founder, one of the most common questions you’ll face is how to pay yourself....
How Do CEOs Make Decisions in High-Pressure or Uncertain Situations?
CEOs often face decision-making moments under extreme pressure and uncertainty—whether...