Тип строки в Python имеет очень много удобных методов. Сегодня пост про два таких метода которые чаще всего используются "однобоко". Это методы startswith() и endswith()
Самый обычный сценарий использования — проверка, начинается ли строка с указанной подстроки?
>>> "some_string".startswith("some")
True
И аналогичная ситуация с зеркальным вариантом этой функции, проверка совпадения с конца
>>> "some_string".endswith("some")
False
Так они используются в большинстве случаев что я видел. Но у этих функций есть еще два варианта использования.
🔸Сравнение нескольких подстрок
Для проверки нескольких подстрок в одной строке обычно вызывают эти функции несколько раз. Но на самом деле достаточно передать кортеж со всеми строками один раз. Если будет хоть одно совпадение то функция вернёт True.
>>>"my_image.png".endswith(("jpg", "png", "exr"))
True
🔸Диапазон поиска
Вторым аргументом можно передать индекс символа с которого следует начать сравнение, а третий аргумент это индекс последнего символа.
>>> ".filename.ext".startswith("file", 1)
True
>>> "file_###.ext".endswith('#', 0, -4)
True
Индексы можно указать отрицательными, что означает отсчёт с конца.
#trics#basic
🔥#GRAM сожгли 50% эмиссии токена
💎 Это стало самым крупным сжиганием в тоне, а также привело к росту в два раза.
Немного истории
Павел Дуров хотел с помощью TON создать децентрализованную блокчейн-платформу для приложений и быстрых транзакций. Целью было интегрировать криптовалюту GRAM в Telegram, позволяя пользователям совершать платежи прямо в мессенджере.
Биржи:
🛒Binance🌐ByBit🌐 OKX
⭐в благодарность за труд ставьте звезду на пост
#Airdrop#листинг#gram
Gram Wallet для Android
Вчера ночью на сайте TON появился Gram Wallet для настольных платформ. Вместе с ним был опубликован исходный код приложений, в том числе и для мобильных устройств.
Мы собрали кошелек для Android.
#Android#gram
MyTonWallet v3.3 update and Gram DNS integration into the wallet
🎁 The year 2025 in the TON blockchain began with a boom in Telegram NFT gifts, and the MTW team responded quickly: #MyTonWallet became the first wallet to provide full visual support for gifts in HD quality with maximum FPS. The wallet logo was also updated, which is especially noticeable when using TON Connect.
Details of the update v3.3:
👛Transparent fees – now when exchanging (swap) you can click the “Info” button to find out the exact cost of the transaction and see how much $TON will be returned back.
👛The new "Explore" v2.0 section is an updated version of the "Overview" tab, which is now in a separate panel. The interface has been redesigned: new banners have appeared, and applications are now conveniently grouped into categories.
👛MyTonWallet Pay is a new tool for paying with cryptocurrency in online stores. The function is currently being tested, and its full launch is expected later. If you have your own store and want to integrate MTW Pay, contact 💬Irina@eeraarons.
📺 We have left short videos under this post so that you can clearly evaluate all the innovations.
☺️Bonus: In honor of the anniversary of Gram DNS, Crypto Bot and MyTonWallet unexpectedly added it to their services.
#TON#MTW#Gram#Gift
🦄🦄Telegram is raising $1.7 billion in funding - and they're not even done!
#Telegram raised $850 million from 94 investors in March in addition to $850 million it gained in February. That's almost two whole unicorns in the largest #ICO (Initial Coin Offering) to date.
The company, founded by self-exiled Russian Pavel Durov, plans to use the ICO proceeds to develop the Telegram Open Network #blockchain, which includes the cryptocurrency #Gram.
Interest in the Telegram ICO has recently helped the company surpass the threshold of 200 million monthly active users, “with over 700,000 new users signing up each day.”
🚀@PerspectiveIX
🌀 http://prs.pctvix.co/TelegramIX