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

Резултати

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

Пребарај: #fantom

当前筛选 #fantom清除筛选
Algebra DEX Engine

@cryptoalgebra · Post #2012 · 18.09.2024 г., 13:00

🦄 V3 DEXes featuring concentrated liquidity & dynamic fees powered by Algebra are taking over! 💪 Shoutout to SuperSonic DEX, the advanced DEX built natively on Sonic Labs (fka #Fantom) with Algebra's groundbreaking V3 AMM. 🤖🔧 ⚡️ Get ready for up to 95% efficiency soon on the Sonic Network!

Hashtags

🎉🎄НОВОГОДНИЕ УТРЕННИКИ В ПОДРАЗДЕЛЕНИИ СЛУЖБЫ ПСИХОЛОГО-ПЕДАГОГИЧЕСКОГО И МЕДИКО-СОЦИАЛЬНОГО СОПРОВОЖДЕНИЯ! 🎉🎄 Хотим поделиться с вами замечательной новостью! В нашем подразделении службы психолого-педагогического и медико-социального сопровождения началась серия ярких и волшебных новогодних утренников! 🎄🎁 Наши талантливые педагоги показали театральную зарисовку «Сказочный хоровод». Дети получили море положительных эмоций и незабываемые впечатления. Атмосфера праздника, радости и веселья царила на протяжении всего мероприятия. Украшенный зал, яркие костюмы, сверкающая ёлка, Дед Мороз со Снегурочкой и, конечно же, долгожданные подарки – всё это создало ощущение настоящего новогоднего чуда. 🌟🎉 Выражаем благодарность Установочному центру Fantom, который оказал благотворительную помощь в приобретении новогодних подарков для детей. #fantom https://vk.com/fantom_tmb

Hashtags

JJ.ai (NFA)🪽

@jsmjsmxyz · Post #1201 · 23.03.2023 г., 19:51

The #FantomHackathon Q1 2023 was a huge success! 🎉 Winners include familiar faces, plus introduce many new projects to the #Fantom ecosystem 🏆⤵️ 🥇 $10k @EstforKingdom (#GameFi) 🥈 $7.5k Rezy (recycling) 🥉 $5k Hazed (privacy) Congrats all! Full list: https://fantomq12023.devpost.com/project-gallery https://twitter.com/FantomFDN/status/1638988754659713024?s=20

Nomis | Onchain Reputation Protocol

@nomis_protocol · Post #538 · 14.11.2024 г., 14:03

✉️ Nomis x EYWA Protocol: Real utilities for the real DeFi guys Meet EYWA Reputation Score: Prove Your Cross-Сhain Activity and Be Eligible For the Airdrop SCORE YOUR WALLET TO START FARMING We've partnered with EYWA, the cross-chain trading powerhouse that aggregates Curve Finance pools, to ensure airdrops go where they're earned—right to real degens like YOU 🫵 🖥HOW TO GET STARTED: 1. Visit THE SCORE PAGE to get your Score 2. Go to THE SWAP PAGE 3. Make cross-chain swaps using EYWA and farm extra points 4. Check your total points HERE 5. Wait for the airdrop date to be revealed! 🔝 In the meantime, make more swaps, increase your EYWA Score, and farm points! ➡️HOW TO BOOST YOUR SCORE: Make swaps across #Ethereum, #Optimism, #BSC, #Polygon, #Fantom, #Arbitrum, and #Avalanche The higher swaps volume, the higher your Score! ➡️HOW TO GET MORE POINTS: The higher your Score, the bigger rewards! 🚨 EXTRA REWARDS TIPS: • Score < 60: Earn 15 points per Score • Score 60-80: Earn 18 points per Score • Score 80+: Earn 20 points per Score (max 2000 points) It seems like we've covered all the questions 🧐 Missed anything? Reach out in the comments! And now... Get in, Get yours, LFG⚡️

Venture Village Wall 🦄

@venturevillagewall · Post #3814 · 07.01.2025 г., 19:00

Bitcoin Caps and Central Banks 🌍 *Salvador Nasralla*, Honduras' leading presidential candidate, recently wore a Bitcoin cap in an interview. 💬 *Michael Saylor* claims Bitcoin at $100,000 is still a 90% discount. 📉 In a dramatic case on Chinese Twitter, a recent fight between a BTC whale and founder of Solv Protocol led to the creation of the *ZachAI* ($ZAI) token, with the whale dumping on followers post-launch. 🇨🇿 Czech Central Bank is considering BTC as a reserve asset. 🔥 50 million USDC burned at USDC Treasury. 🏗️ President-elect Trump announces $20 billion investment in new data centers in the U.S. #Bitcoin#BTC#Crypto#USDC#Solv#AI#ZAI#CzechRepublic#Honduras#Investment#Trump#DataCenters#Curve#Treasury#Ethereum#Blockchain#CryptoWhale#Fantom#Sonic

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.