TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #22 · 19 јан.

Заметка начинающим, которые часто сталкиваются с подобной непоняткой. Ситуация следующая, есть список файлов: names = [ 'image.bmp', 'second.txt.bkp', 'data.db', '.config.cfg', 'file.ext.bkp' ] И мы хотим убрать у них окончание ".bkp". Не знаю зачем, пример довольно надуманный) Но суть он показывает, а это главное. Те, кто еще не очень знаком с библиотекой os.path или pathlib, вероятно решат обработать имена как строки. И тут вполне подойдет метод строки strip(). Что делает этот метод? Он отрезает указанные символы по обеим сторонам строки. Если ничего не указать, то убирает невидимые символы (пробелы, табуляции и переносы строк). В нашем случае будет выглядеть вот так: >>> name.strip('.bkp') То есть просим удалить строку '.bkp' по краям имени файла, если таковая есть. Можно применить аналогичный метод rstrip(), чтобы отрезать только справа, но для этого примера используем обычный. >>> for name in names: >>> print(name.strip('.bkp')) image.bm second.txt data.d config.cfg file.ext Хм, что-то не то с нашими именами! Что случилось??? Видим нежелательное переименование в именах, где и близко не было указанной строки '.bkp' А дело всё в том, что данный метод ищет не указанную строку, а указанные символы, и не важно в каком порядке. Для метода strip() строка '.bkp' это не паттерн для поискаа список символов. Потому он отрезал симовол 'p' от '.bmp' и удалил точку из файла '.config.cfg'. Как тогда правильно заменить именно паттерн? Для начинающего можно посоветовать метод строки replace(), который как раз использует для замены указанную строку целиком. В нашем примере заменим её на пустую строку. >>> for name in names: >>> print(name.replace('.bkp', '')) image.bmp second.txt data.db .config.cfg file.ext Уже лучше, но помните, это лишь пример про strip(). Для работы с именами файлов есть способы и более "правильные", дающие однозначно верный результат. Я взял файлы только в качестве примера. Даже replase() тут может сделать не то что ожидаем. Просто впредь будьте внимательны с этим strip(). #basic

Hashtags

Резултати

Пронајдени 7 слични објави

Пребарај: #traders

当前筛选 #traders清除筛选
TONlines – News

@tonlines · Post #7625 · 27.11.2025 г., 09:27

⚡️MRKT League: Autumn Champions Announced #MRKT#traders The Autumn Open League on MRKT has concluded, with winners now available in the app. A total of 50 traders earned prizes, ranging from a Plush Pepe to a Heroic Helmet. The next tournament has started, with results to be announced on December 3. Source: link @tonlines

TONlines – News

@tonlines · Post #7575 · 21.11.2025 г., 19:05

MRKT: Prepare for the Next Trading Opportunity #MRKT#traders MRKT provides a new opportunity for traders to buy Stars at the best price and participate in the upcoming trading rush. Direct purchase through @mrktbank is available. Source: link @tonlines

TONlines – News

@tonlines · Post #7538 · 19.11.2025 г., 18:41

MRKT: Autumn Open League Concludes #MRKT#traders The Autumn Open League hosted by MRKT has concluded, celebrating top traders with prizes like Plush Pepe and Durov’s Cap. A new tournament is already underway, inviting more participants to join. Source: link @tonlines

ProtradeFx

@protradeforex · Post #9938 · 19.02.2026 г., 09:19

The @OrderOfMentors now have a YouTube channel, please subscribe and share your charts in the YouTube community group chat to help us attract other traders. Your help is needed to grow. https://youtu.be/Xi4qxpq-2GU?si=t7GfRMqfC93j0Fk8 #OOM#Traders#Jayfx

Venture Village Wall 🦄

@venturevillagewall · Post #3913 · 18.01.2025 г., 13:00

Bitcoin Predicted to Reach $200K by 2025 CryptoQuant analysts forecast Bitcoin may hit $200,000 by 2025. Driving factors include: ✔️ $520 billion institutional capital influx ✔️ Easing monetary policy and favorable crypto regulation ✔️ Historical price surges in the final year of four-year cycles. For more details, visit Forklog News. #Bitcoin#Crypto#Market#Analysis#Forecast#Investment#Institutional#Regulations#BullMarket#Trends#Finance#CryptoNews#Blockchain#Tech#Economy #2025 #Capital#Growth#QuantAnalysis#Traders#Volatility

Venture Village Wall 🦄

@venturevillagewall · Post #4338 · 08.03.2025 г., 10:00

Utah Establishes First Bitcoin Reserve 🔵 Utah becomes the first U.S. state to create a strategic Bitcoin reserve. This initiative aims to enhance regional economic stability and protect state assets from inflation and market fluctuations. Read more here. 🔴 In contrast, Russia remains hesitant to include Bitcoin in its National Wealth Fund, citing its volatility. Nevertheless, the Deputy Minister of Finance indicated a review of the strategy may occur if reserves reach a certain level, potentially incorporating higher-yield assets like crypto in the future. Read more here. ⭐️ Gemini cryptocurrency exchange confidentially filed for an IPO, partnering with Goldman Sachs and Citigroup, potentially eyeing a market entry in 2025. More details available here. #Bitcoin#Utah#Crypto#Russia#IPO#Gemini#Finance#Market#Investment#ETF#Volatility#Assets#Economy#Regulation#Wealth#Liquidity#Traders#CryptoExchanges#BNB#BSC#VC

Venture Village Wall 🦄

@venturevillagewall · Post #3760 · 31.12.2024 г., 13:00

XRP Market Insights and Predictions 📉 Current XRP Price: $2.16 with a $123B market cap. Trading volume: $2.21B. 📊Consolidation Phase: Support at $2.1, resistance at $2.5. RSI: 49.81 | Stochastic: 26.35 | CCI: -95.21. Mixed signals overall, MACD suggests bearish sentiment. 🔄Short-term Downtrend: Testing support at $2.115; resistance at $2.22 - $2.25. EMAs indicate sell signals for 10- and 20-periods. 📈Bullish/ Bearish Scenarios: Break above $2.25 targets $2.5; break below $2.1 targets $1.9. Traders should implement tight stop-losses. Full analysis details can be read here. #XRP#Crypto#MarketAnalysis#TradingStrategy#Investing#TechnicalAnalysis#PricePrediction#Bullish#Bearish#Support#Resistance#EMAs#MACD#RSI#Stochastic#CCI#Volume#Traders#Bulls#Bears#Consolidation