Тип строки в 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
🔖McHenry urges Senate to pass FIT21 crypto bill before election
The United States House’s widely positive vote on the crypto-regulating FIT21 bill should be “a wake-up call” to the Senate to quickly pass it, says Rep. Patrick McHenry 💬
#Cryptotrader
#Cryptotwitter
#Cryptoinvestment
#Cryptocurrencyexchange
USAcoin Proposal by Peter Schiff
Peter Schiff suggests that instead of building a strategic reserve in BTC, the U.S. could save money by launching a new cryptocurrency called USAcoin, which would have a capped supply of 21 million coins, utilizing updated blockchain technology for payment efficiency. He emphasizes the potential wealth this could generate and encourages HODL. 🔗Read more here🔗Join Crypto Twitter
#USAcoin#Cryptocurrency#BTC#Blockchain#PaymentSystems#Investment#WealthBuilding#HODL#Crypto#Finance#PeterSchiff#CryptoTwitter#DigitalCurrency
BTC Buying Surge Amid Drops
Despite a slight drop in Bitcoin prices, major players are buying in:
🔵 Marathon purchased BTC worth $1.53 billion.
🔵 BlackRock acquired $359 million in BTC.
🔵 Hut8 invested $100 million.
🔵 Michael Saylor likely preparing to buy another $3 billion.
🔥 States are also secretly accumulating Bitcoin.
#Bitcoin#Marathon#BlackRock#Hut8#MichaelSaylor#Crypto#Investment#Market#Trading#Assets#Finance#DigitalCurrency#Blockchain#CryptoTwitter#BTC#Bullish#Wealth#Economy#Currency
Bitcoin Mining Ban and Market Resilience
In 2021, China's ban on Bitcoin mining caused market panic, leading to a significant dip. However, this event has less relevance now. Bitcoin continues to show resilience despite fluctuations. Data from PumpFun reveals that only 0.4% of meme coin traders made over $10,000, while 60% ended with losses. Most users either broke even or earned little. For insights on meme coin trading, check this post.
#Bitcoin#Crypto#Trading#MemeCoins#MarketTrends#Mining#Investing#Blockchain#Finance#PumpFun#Statistics#MarketDip#Profit#Losses#Trader#Wealth#InvestmentStrategy#CryptoTwitter
FTX Announces Preliminary Fund Distribution Schedule
🔵 FTX reveals a preliminary payment distribution schedule for creditors.
🔵 Claims under $50k total $1.2 billion.
🔴 By January 20: Preliminary claims must be met.
🔴February 25 - March 4: Expected period for fund distribution begins.
🤔 Will this bring additional liquidity to the market?
Read more
#FTX#Crypto#Market#Liquidity#Payments#Claims#Finance#Investments#Bitcoin#News#Updates#Distribution#Schedule#CryptoTwitter#Investors#Creditors#Funds#Return#January#February#March