Тип строки в 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
#LSK/USDT analysis :
#LSK is in a downtrend, trading below the 200 EMA and forming lower lows (LLs) and lower highs (LHs). The price is currently within a resistance zone, and it is anticipated to reverse from this level, resuming its bearish momentum to test lower price levels.
TF : 4h
Entry : $0.760
Target : $0.665
SL : $0.808
#LSK/USDT analysis :
#LSK has broken down and retested the resistance zone. The price is expected to bounce back from there and continue its bearish momentum to test the previous swing low.
TF : 4H
Entry : $0.825
Target : $0.745
SL : $0.878
📊#LSK is breakout the descending triangle with a descent volume. It got rejected from the MA 200 and currently, facing the Ichimoku cloud.✅
💬A candle close above the triangle or a break above the MA 200 would be the confirmation of a bullish rally.
❄️@signals_bitcoin_crypto❄️
❄️@Shadow_support0o❄️
#LSK/USDT analysis -
#Lisk is experiencing a corrective pullback, creating a quick scalp opportunity on the buy side. Price is following a trendline. It is expected to bounce off from there and test the 200 EMA resistance level.
TF : 15min
Entry : $0.832
Target : $0.856
SL : $0.817
Today. I added to my experimental portfolio a coin - Lisk#LSK paired with #USDT on the Binance cryptocurrency exchange.
For me, this coin looks attractive for a long-term investment.
🛒Motives for buying#LSK
#Lisk ranks 63rd in the CoinMarketCap rating.
Good fundamental analysis is expected by the end of the year, including the halving on September 28.
The coin was not pumped!
The price is close to the resistance zone $1.6555-1.8727,
Support level is the $1.2840-1.0440.
The price projector points to a rise of $3.30.
I expect to grow from 130% to 180%.
🎯 Fibonacci 10$ experiment.