Заметка начинающим, которые часто сталкиваются с подобной непоняткой.
Ситуация следующая, есть список файлов:
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
OKX Invite Sprint S2 💨
Take the lead 🏆
Prize:
250 USDT waiting for you to win!
🥇 1st : 70 USDT
🥈 2nd : 50 USDT
🥉 3rd : 30 USDT
🎁 4th : 25 USDT
🎁 5th - 7th:15 USDT
🎁 8th - 10th:10 USDT
How to earn points👇
1 Sign up on OKX
2 Join & stay at OKX Global Discord
3 Invite friends through your personal invite link to earn points (1 referral = 1 point)
- The invite leaderboard determines the main ranking
- Command /leaderboard invites to check invites
4 Chat in #general-chat to earn XP points
- XP points help boost engagement, but invite points are the priority.
5 Rewards will be distributed based on total points from invites + XP
6 Submit this Form for reward distribution
📆 Event Period: 16/2/2026, 9:30 AM - 27/2/2026, 6:00 PM (GMT+8)
👇
Join now
Our Socials:
⚜️Sign Up on OKX | Join Affiliate | TG | DC | Wallet TG | Wallet Announcement | OKX on Spotify | Twitter/X | YouTube
⭐️CN DC | CN TG
‼️Please check the authenticity of all OKX links or channels at OKX channel verification
OKX Invite Sprint ♾️
"Grow the circle"
Prize:
250 USDT waiting for you to win!
🥇 1st : 70 USDT
🥈 2nd : 50 USDT
🥉 3rd : 30 USDT
🎁 4th : 25 USDT
🎁 5th - 7th:15 USDT
🎁 8th - 10th:10 USDT
How to earn points👇
1 Sign up on OKX
2 Join & stay at OKX Global Discord
3 Invite friends through your personal invite link to earn points (1 referral = 1 point)
- The invite leaderboard determines the main ranking
- Inviting new members is the fastest way to climb the leaderboard
4 Chat in #general-chat to earn XP points
- XP points help boost engagement, but invite points are the priority.
5 Rewards will be distributed based on total points from invites + XP
6 Submit this Form for reward distribution
📆 Event Period: 15/1/2026, 9:30 AM - 21/1/2026, 6:00 PM (GMT+8)
👇
Join now
⚜️Sign Up on OKX | Join Affiliate | TG | DC | Wallet TG | Wallet Announcement | OKX on Spotify | Twitter/X | YouTube
⭐️CN DC | CN TG
‼️Please check the authenticity of all OKX links or channels at OKX channel verification
😄General
➖➖➖➖➖➖
🔘General is an adjective that's similar to 'common'.
🔜 It's a general day in the UK today - a bit cold and wet.
🔘General can also mean basic.
🔜 This book will give you a general understanding of human biology.
🔘General is often used in the phrase 'in general', which means usually.
🔜 It rains a lot here, in general.
#General👨🏫@America
➖➖➖➖➖➖➖➖➖➖➖➖
🆕 Crypto News @Money
😁 Crypto Game @Egame
🇺🇸 US News @America
🇯🇵 Japan News @Japan
🇦🇪 UAE News @Dubai
▶️ Popular Movies @Videos
😜 Best Funny Video @Funnys
😄General
➖➖➖➖➖➖
🔘General is an adjective that's similar to 'common'.
🔜 It's a general day in the UK today - a bit cold and wet.
🔘General can also mean basic.
🔜 This book will give you a general understanding of human biology.
🔘General is often used in the phrase 'in general', which means usually.
🔜 It rains a lot here, in general.
#General👨🏫@America
➖➖➖➖➖➖➖➖➖➖➖➖
🆕 Crypto News @Money
😁 Crypto Game @Egame
🇺🇸 US News @America
🇯🇵 Japan News @Japan
🇦🇪 UAE News @Dubai
▶️ Popular Movies @Videos
😜 Best Funny Video @Funnys
🚨 Airdrop: DreamTime Metaverse
🔥 Total Reward: $100,000 Worth Of ETH + NFT
🤑 Refer: Top 10 Referrals
🛃 Website: https://brocothedino.io/
🚧 Rating: ⭐️⭐️⭐️⭐️⭐️
📛 Winners : 1000 Random + 20 Top Referrals
🤖 Airdrop Link : https://airdrop.brocothedino.io/
===========================
📝 Tasks:
🔘 Join The Airdrop Campaign
🔘 Join Discord and introduce yourself in #general chat. Invite 3 friends on Discord
🔘 Follow Broco The Dino by DTMV on Twitter, Like and Retweet Pinned Tweet, and tag 3 friends
🔘 Join Broco The Dino by DTMV on Telegram and introduce yourself.
🔘 Submit ETH ( Ethereum ) Address Get It From Trust Wallet Or MetaMask
===========================
📅 End Date: 29 April 2022
🚀 Distribution Date: Will be announced on Discord
🔴 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 token.
💬New Zealy Task — Interact in Discord!
Your feedback matters! 🌍✨
Join our official Discord and share what you enjoy the most about the Health Hero Bot — how it keeps you consistent, motivated, and leveling up every day. ⚡️
🧩How to complete the task:
1️⃣ Join the Discord → https://discord.gg/gorwachain
2️⃣Go to#general-chat
3️⃣ Send a message about your favorite part of the bot (features, streaks, rewards, motivation, etc.)
4️⃣📸 Take a screenshot of your message and upload it on Zealy to claim your XP!
Let’s show the world how the Health Hero Bot keeps the community strong and engaged 💪
💬 Join now:
👉https://zealy.io/cw/gorwachain/leaderboard/2623fee8-db99-41c9-a059-2a24c54858d3
🚀Go! SmartChain AI OG Campaign Launches!🌟
Join the epic Go! SmartChain AI OG Quest and compete for a massive 300K $GoXP prize pool! Harness the innovative power of AI to craft your unique gaming and engagement story. 🎮💥
How to Participate:
1️⃣Join Us on Discord: Become a pioneering member of our community at https://guild.xyz/gorwachain#
2️⃣Tackle the Quests: Complete five interactive quests across various Web3 platforms to earn unique roles within our Discord community.
3️⃣Achieve "GO_OG" Role: Earn recognition for your quest achievements with the exclusive "GO_OG" role.
4️⃣Receive Your OG NFT: Unlock special perks and rewards within the Go! ecosystem with your very own OG NFT.
🗓Quest Timeline: Ends May 23, 2024
🎁Rewards:
🪙 300K $GoXP Prize Pool: Compete and claim your share of the significant prize pool.
🏞 OG NFT - Go!Cats: Not only a symbol of status but also a key to further engagement and rewards.
💰In-Game Purchase Bonuses: Earn vouchers worth 5–40 $GoXP to acquire more Go!Cats or other assets at a discount.
🚀$GoXP Token Airdrop: Stay tuned for more exciting features for $GoXP holders, with significant benefits for early adopters.
🔧Need Help?
General Inquiries: Have questions? Reach out in our #general-chat on Discord. Also check out more details at https://www.goplatform.io/ogcampaign
Technical Support: Facing issues? Open a support ticket on Discord.
🌐 Embark on your journey to become an OG with Go! SmartChain AI today! Don’t miss out on becoming part of the foundational community driving the future of blockchain gaming. Good luck, adventurers! 🌟
🎉 Walken x Wirex: Пасхальный Квиз🎉
Разбавляем ваши будни и приглашаем принять участие в Пасхальном Квизе в нашем Discord и получить шанс выиграть приз от нас и наших партнеров Wirex!
🗓Когда: 11 апреля, 18:00 МСК
📌Где: https://discord.com/channels/897468313507074049/963986187280850994
🎁Награды: каждый из 10 победителей получит по $10 в WLKN + $10 в WXT
Как принять участие:
☑️ Присоединитесь к Walken Discord
☑️ Присоединитесь к Wirex Discord по ссылке: https://discord.com/invite/f8UGp4dH6g и изучите информацию об их продуктах (это поможет вам успешно ответить на вопросы в Квизе)
☑️ 11 апреля в 18:00 МСК перейдите в канал #General в Walken Discord и в режиме реального времени ответьте на вопросы - старайтесь отвечать на них не только быстро, но и правильно!
⚠️ Обращаем ваше внимание, что для получения награды WXT от наших партнеров, вам необходимо установить приложение Wirex и создать там учетную запись.
TOP-10 участников Квиза, получивших наибольшее количество баллов и присоединившихся к Wirex Discord, заберут призы🥇
Обведите этот день в календаре 🗓 и не упустите возможность повеселиться! Увидимся завтра в Discord! 🚀
🎞Pika Labs - генерация коротких видео по тексту
🤖Нейросеть Pika Labs умеет создавать короткие видео по промптам и вложенным изображениям.
👣Как пользоваться: присоединяетесь в канал discord, заходите в любую из веток #general, пишите /create и далее свой промпт.
🌐Источник (бесплатно): http://discord.gg/pika
Уверенный WORK: лайтовый тестнетик с пулом 60М$+🏄♂️
ℹ️Mantra — L1-решение, которое запускает собственный L1-чейн.
Парочку месяцев подряд мы проходили первую фазу тестнета (задания на Galxe), сейчас же был сделан анонсвторой части: тут нам нужно будет активничать в тестовой сети Mantra Hongbai Testnet, пул наград –50 млн $OM (~60 млн$, токен на Binance торгуется).
🍟Активность абсолютно фри:
1️⃣ Устанавливаем Leap Wallet, в правом верхнем углу кликаем на лого Cosmos и добавляем тестовую сеть Mantra
2️⃣ Топаем на 👉сайтик и коннектим наш Leap
3️⃣ Теперь проходим проверку на бота в 🦀дискорде, в ветке #general оставляем заявку на кран
4️⃣ Перед нами должна появиться ветка #hongbai-faucet, там вводим команду /request + ваш OM-адрес и получаем 0,2 $OM
5️⃣ Делаем такой запрос 5 раз, чтобы на балансе был 1 $OM
6️⃣ Теперь идём в Leap и нажимаем на Stake (2 раза), выбираем любого валидатора и вписываем 1 $OM
7️⃣ В итоге нам дадут 5 поинтов KARMA здесь
▪️Crypto Time
Family disputes reports of #court appearance as detained #General seen after four days
Four days after his arrest, the family of Brigadier General Guesh Gebre say they were allowed a brief visit with the detained commander but rejected reports that he had been brought before a court, stating that he has neither appeared before a judge nor consulted a lawyer since his detention.
Speaking to Addis Standard on Wednesday, the general’s brother, Yibrah Gebre, said Guesh told family members that he had not been formally presented to a court. “Two individuals came to the detention facility, introduced themselves as a judge and a prosecutor, and then left,” Yibrah said, adding that no court hearing took place.
https://addisstandard.com/family-disputes-reports-of-court-appearance-as-detained-general-seen-after-four-days/?amp=1