Python Slice Object
Postado 2023-02-27 22:23:14
0
12KB
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")
Pesquisar
Categorias
- Arts
- Business
- Computers
- Jogos
- Health
- Início
- Kids and Teens
- Money
- News
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leia mais
Is the On-Demand Economy Sustainable?
A few years ago, I watched a delivery driver step out of his car in the middle of a rainstorm. He...
How to Learn to Tie Sea Knots
Sea knots for novice yachtsmen are one of the first sections of training in a sailing school....
What Tools and Methods Support PMMs?
Product Marketing Managers (PMMs) juggle a wide variety of responsibilities: market research,...
Psychosis: Methamphetamine
Methamphetamine induces a psychosis in 26–46 percent of heavy users. Some of these people...
What Are the Different Types of Memberships? Understanding the Many Ways Organizations Create Belonging
When most people hear the word "membership," a surprisingly specific image often comes to mind....