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

Резултати

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

Пребарај: #trust

当前筛选 #trust清除筛选
Илья AGI TV 🤖

@ilia_plasma · Post #221 · 16.10.2023 г., 15:14

Новый нахваленный дизайн #Trust Wallet Теперь понятно почему #TWT токен упал. Глаза немного болят 😡

Hashtags

Airdrop3 LTD

@airdrop3ltd · Post #157 · 16.07.2021 г., 17:30

DUSD NETWORK #AIRDROP#TRUST WALLET #AIRDROP#META MASK Free 🎁 200 (DUSD) Tokens Reward 🎁 for a referral 50% = 100 (DUSD) ✅Open Trust wallet ✅Go to DApps ✅Copy & Paste Airdrop link below in Dapp Search Box: 👇 Project Link : https://dusd.network/ 👇 Airdrop Link : https://dusd.network/airdrop/index.html 🔹Change network to Smart chain 🔹Click Claim Airdrop (Little $0.18 Fee Required in BNB) Listing Pancakeswap 30th October, 2021. LISTING PRICE: 1 DUSD = 0.3 USD ✅To be listed at coinmarketcap ✅Add custom token: Contract Address: 0x5eba288f8833071ba7cd5c2b356754811c0ce8fb ✅BSCSCAN https://bscscan.com/token/0x5eba288f8833071ba7cd5c2b356754811c0ce8fb ✅TELEGRAM GROUP LINK: https://t.me/dusd_network ✅Twitter LINK https://twitter.com/DusdNetwork ✅Reddit Link https://www.reddit.com/user/DUSD_Network ✅discord.com https://discord.gg/m62cgWbP ✅Youtube https://www.youtube.com/channel/UCKlGuOEocIIwIGh8V2H8DFg ✅Medium https://medium.com/@dusd.network

Mexc Dex Spread Tracker Alerts

@mexcdex · Post #24040 · 15.04.2026 г., 09:21

🟢 LONG? #TRUST Spread 8.16% detected 💥 Origin: MEXC (DUMP) [M: -10% VS D: -3%] 💎 Intuition #TRUST_USDT (COPY: TRUST) 🌐 Price DEX $0.09270 🎰 Price MEXC $0.08571 ️⚖️ Max Size: 23K $TRUST ($2K) 💹️ Funding Rate: -0.4395% 🏦 Market Cap: $16.7M 💰 Liquidity: $383K 💸 Vol DEX/MEXC: $243K / $525K ⛓️#BASE Dep: 🟢 (1800) W/d: 🟢 0x6cd905dF2Ed214b22e0d48FF17CD4200C1C6d8A3 ⏳Avg Align Time: 94s 📊Avg Spread / Max / Change: ±5% / ±5% / ±3% 📈Win / Draw / Lose: 1 / 0 / 1 💰Total / Week / 24H Profit: -0% / -3% / -3%

AI & Law

@ai_and_law · Post #96 · 28.08.2023 г., 07:04

Twilio Introduces "Nutrition Labels" to Boost Trust in AI Hello AI&Law society! Twilio, a communication tool services company, is taking a proactive step to enhance transparency and trust in its artificial intelligence services. The company is introducing "nutrition labels" for its AI models, providing information about the data used for training, the purpose of data collection, and more. The labels aim to offer users a clear understanding of how their data will be utilized. The "nutrition labels" highlight key aspects such as which AI models are being employed, whether customer data is used for training, and whether human involvement is integrated. Additionally, Twilio offers an online tool that enables other companies to generate similar labels for their AI products. Twilio's initiative aligns with broader industry efforts to ensure responsible and transparent AI practices. Salesforce, for instance, is also unveiling an acceptable use policy for its generative AI technologies, specifying prohibited practices and emphasizing responsible AI usage. #AI#Transparency#DataPrivacy#Trust#ResponsibleAI#Twilio#Salesforce

AI & Law

@ai_and_law · Post #29 · 15.06.2023 г., 07:04

Cybersecurity and AI: mapping key issues in the EU The European Union Agency for Cybersecurity (ENISA) has released a comprehensive report highlighting key cybersecurity issues in the field of artificial intelligence. The report aims to shed light on potential risks and provide guidance for policymakers, businesses, and AI developers. The report identifies several critical areas that require attention. One key concern is the security and integrity of AI systems, emphasizing the need for robust safeguards against unauthorized access, data breaches, and malicious attacks. It also highlights the importance of ensuring the privacy and protection of personal data used in AI processes. Additionally, the report emphasizes the significance of transparent and explainable AI algorithms. Clear accountability and understandable decision-making processes are vital to building trust in AI systems and avoiding potential biases or discrimination. #AI#Cybersecurity#EU#DataProtection#Privacy#Transparency#Trust#Cyberthreats

12
ПретходнаСтраница 1 од 2Следна