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

Резултати

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

Пребарај: #ethereumetf

当前筛选 #ethereumetf清除筛选
SpotOnChain | Announcement

@spotonchain · Post #830 · 21.05.2024 г., 02:57

3 hours ago, James Fickel (@jamesfickel) swapped another 350 $WBTC for 6,905 $ETH ($24.4M) at ~$3,534 as the $ETH price soared 20% (24H)! Note that since Dec 30, 2023, the founder of Amaranth Foundation has been bullish on the ETH/BTC trading pair, borrowing and exchanging 2,741 $WBTC for 50,688 $ETH at an ETH/BTC ratio cost of 0.054. Follow @spotonchain and visit James Fickel’s address at https://platform.spotonchain.ai/en/profile?address=0xd85351181b3f264ee0fdfa94518464d7c3defada #EthereumETF#Approval

TON Crypto News

@toncoin_rap · Post #112 · 05.09.2024 г., 14:14

🎧⤴ Ethereum ETF Set to Ignite Prices – Could ETH Hit $4,500? Monochrome Asset Management has filed to launch an Ethereum ETF in Australia under the ticker "IETH." If approved, the ETF will offer a regulated way for retail investors to buy into Ethereum, marking a crucial expansion of crypto products in Australia. Analysts predict this could push ETH prices towards $4,500, especially if Bitcoin continues its upward momentum. Verse 1: ETF drop, watch the markets shake, IETH comin’, time to raise the stake, Aussie brokers lined up, ready to go, Regulated crypto, yeah, it’s the show. Chorus: Will ETH hit that 4-5-0-0? Markets movin’ fast, now they wanna know, Monochrome pushin’ for the big rise, Crypto to the moon, no surprise. Verse 2: Bitcoin’s on fire, aim for that 100K, Ether right behind, it’s a bull run day, Dual-access cash flow, simple as can be, Australian retail gonna stack that ETH, see? Chorus: Will ETH hit that 4-5-0-0? Markets movin’ fast, now they wanna know, Monochrome pushin’ for the big rise, Crypto to the moon, no surprise. Bridge: Hold tight, watch that price climb high, Regulated ETF, no more askin’ why, Cash or in-kind, take your pick, Ethereum’s future, man, it’s lookin’ slick. Verse 3: From Bitcoin to ETH, it’s all on track, Regulators here, no more lookin’ back, Australia leads, yeah, they’re paving the way, Crypto in the mainstream, here to stay. Chorus: Will ETH hit that 4-5-0-0? Markets movin’ fast, now they wanna know, Monochrome pushin’ for the big rise, Crypto to the moon, no surprise. #EthereumETF #CryptoInvestment #TONCryptoNewsRapStyle 🎧@toncoin_rap

Venture Village Wall 🦄

@venturevillagewall · Post #3871 · 14.01.2025 г., 07:00

Crypto Funds Struggle Compared to Bitcoin OKX's founder Star claims no crypto fund has outperformed Bitcoin over the last decade, predicting a 100x growth for the industry. He acknowledged feedback on OKB's lack of use cases and poor listings. A new secret business line for OKX is set to launch in February. In other news, Ethereum spot ETFs saw a net outflow of $39.432 million, while Bitcoin ETFs faced a larger outflow of $284 million. Notably, BlackRock's ETHA and IBIT ETFs saw significant inflows. Read more about OKX's updates here, Ethereum's ETF activity here, and Bitcoin's ETF activity here. #OKX#Bitcoin#Ethereum#Crypto#ETFs#BlackRock#OKB#NFTs#Web3#DeFi#Soneium#S.BLOX #Blockchain#Investing#Finance#BitcoinETF#EthereumETF#VC#AI

Crypto M - Crypto News

@CryptoM · Post #65177 · 11.04.2026 г., 16:40

🚀 Morgan Stanley Explores Tokenized Money-Market Fund After Bitcoin ETF Launch Morgan Stanley, managing $9.3 trillion in client assets, is considering launching a tokenized money-market fund following its recent introduction of a spot Bitcoin ETF. According to NS3.AI, Amy Oldenburg from Morgan Stanley highlighted the bank's interest in tax-loss harvesting for digital assets through its subsidiary, Parametric. Data from Farside Investors indicates that the new Bitcoin ETF has attracted approximately $46 million in net inflows since its launch on Wednesday. Additionally, Morgan Stanley submitted applications in January for ETFs linked to Ethereum and Solana. #MorganStanley#TokenizedMoneyMarketFund#BitcoinETF#DigitalAssets#TaxLossHarvesting#EthereumETF#SolanaETF#Parametric#NS3AI#FarsideInvestors#CryptoInvesting#BTC#ETH#SOL