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

Резултати

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

Пребарај: #bluefin

当前筛选 #bluefin清除筛选
Airdrop Comic

@airdropcomic · Post #2061 · 14.07.2025 г., 06:25

🔥Airdrop - Bluefin x OKX Cryptopedia ✅ 💰Total Reward: $605,000+ worth of tokens — including $550K in BLUE + $55K in SUI — up for grabs through Cryptopedia Season 38 ☀️Airdrop Link :- Click Here ⚙️How to Participate? ♦️Connect your OKX Wallet (SUI Network) ♦️Complete all tasks within the Bluefin campaign on Cryptopedia ♦️Verify your actions to be eligible ♦️Tasks are simple and interactive — don’t miss out 🎁Eligible participants will earn a share of 605,000 USDT in token rewards 📆Campaign Ends: 6 September 2025 – 7:00 AM UTC 📌Explore DApps, complete missions, and earn rewards this is Web3 made fun and rewarding 🔗 Source: https://x.com/wallet/status/1943597905996034069 ®Note - Please do your own research (DYOR) before joining to any airdrops project, also airdrop is 100% free. Don't send any fee or penny for receiving airdrop tokens required #OKX#Bluefin#Cryptopedia#Airdropcomic#Web3Rewards

SIGNAL

@finsignal · Post #3295 · 22.06.2024 г., 07:33

📰 CRYPTO NEWS 🆕️The founder and CEO of #CryptoQuant stated that compared to the previous cyclical peak, the fundamental elements of the bitcoin network can maintain a market value three times higher than the current one. He considers it "possible" to "keep" the bitcoin price at $265,000. 🆕️As part of the presale, #WATER raised $41 million. Which also makes WATER the largest Memecoin pre-sale to date, with over 26,000 wallets participating. The team has regained control of its account in X. 🆕️50 Cent's #Twitter account was hacked in order to promote the Solana Meme Coin. 🆕️Internet Computer will launch the #ICP Hub Accelerator Program 2024, which aims to help early blockchain projects transform their concepts into market solutions, create a strong blockchain innovation ecosystem and promote technological progress in the ICP community. 🔹 21 million #LINKS ($295 million) of non-convertible Chainlink contracts have been unblocked today. 🆕️DAO Osmosis supports a commission-free bridge for transferring bitcoin to the #Cosmos ecosystem. 🆕️Scroll ZKP presents "Scroll Sessions", a loyalty program to reward the Scroll Marks community for their participation and involvement in the #Scroll ecosystem. 🆕️Arbitrum introduces the "Layer Leap", a single-stage bridge from L1 to L3 for the #Orbit ecosystem. 🆕️#Reef plans to launch a new product on June 26. ‼️ Dogwifhat Whales dropped #WIF by 16 million in a week. 🆕️#Fantom has released #Sonic's third management offering, which includes an annual token destruction mechanism, as well as the launch of Sonic Spark and Sonic University. 🆕️#Bluefin announces integration with Wormhole Connect. The Wormhole community will participate in the future release of Bluefin tokens. 🆕️#StacksNakamoto has announced the completion of 90% of the work on the project and is preparing for the official launch on July 15. The Nakamoto Stacks update should increase the transaction speed to 5-10 seconds, which is about 100 times faster than the current speed. ➡️ This is a significant event for the Stacks project and the Bitcoin ecosystem, will improve the speed, overall efficiency and scalability of Layer2 on #Bitcoin, promising faster and more efficient transactions for users.