TGStat
TGStat
Type to search
Advanced channel search
  • flag English
    Site language
    flag Russian flag English flag Uzbek
  • Sign In
  • Catalog
    Channels and groups catalog Regional compilations Thematic compilations Платные каналы Search for channels
    Add a channel/group
  • Ratings
    Rating of channels Rating of groups Posts rating
    Ratings of brands and people
  • Analytics
  • Search by posts
  • Telegram monitoring
  • Promotion
    Advertising through Yandex Business Advertising in channels through TGStat Agency Advertising on TGStat.ru website
PytStart | Программирование на Python

30 Sep, 12:20

Open in Telegram Share Report

🖥 Срезы (slices) в Python позволяют удобно извлекать части последовательностей (списки, строки, кортежи) с помощью синтаксиса:

sequence[start:stop:step]

🔹start – начальный индекс (по умолчанию 0).
🔹stop – конечный индекс (не включается!).
🔹step – шаг (по умолчанию 1).

📌 Примеры:


lst = [0, 1, 2, 3, 4, 5]

print(lst[1:4]) # [1, 2, 3] (элементы с индекса 1 по 3)
print(lst[:3]) # [0, 1, 2] (с начала до индекса 2)
print(lst[::2]) # [0, 2, 4] (каждый второй элемент)
print(lst[::-1]) # [5, 4, 3, 2, 1, 0] (разворот списка)

⚡ Итог: срезы позволяют легко работать с последовательностями без циклов и лишнего кода!

332 0 7 5
Catalog
Channels and groups catalog Channels compilations Search for channels Add a channel/group
Ratings
Rating of Telegram channels Rating of Telegram groups Posts rating Ratings of brands and people
API
API statistics Search API of posts API Callback
Our channels
@TGStat @TGStat_Chat @telepulse @TGStatAPI
Read
Академия TGStat Telegram Research 2019 Telegram Research 2021 Telegram Research 2023
Contacts
Справочный центр Support Email Jobs
Miscellaneous
Terms and conditions Privacy policy Public offer
Our bots
@TGStat_Bot @SearcheeBot @TGAlertsBot @tg_analytics_bot @TGStatChatBot