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

Резултати

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

Пребарај: #coffeeceremony

当前筛选 #coffeeceremony清除筛选

☕ **ETHIOPIA: WHERE COFFEE BECAME SACRED** 🇪🇹 *The Ancient Ritual That Gave Birth to a $15 Billion Industry* In Ethiopia's highlands, where coffee was discovered 1,200 years ago, the traditional coffee ceremony remains unchanged. This sacred 3-hour ritual transforms green beans into liquid gold through patience and community. **The Sacred Process:** 🌿 Hand-picked beans from ancient forests 🔥 Roasted over charcoal in clay pans 💨 Aromatic frankincense purifies the space 🏺 Traditional jebena pot brews perfection 👥 Three rounds: Abol, Tona, Baraka (blessing) **Economic Impact:** • Ethiopian coffee exports: $1.2B annually • Premium beans: $45-65 per pound • Coffee tourism: $50-150 per ceremony In Ethiopia, coffee isn't just a drink - it's a sacred bond between earth and soul. #EthiopianCoffee#CoffeeCeremony#CoffeeOrigin

ancient history of oromoo

@etbisahusen · Post #2119 · 25.09.2025 г., 17:45

Buna Qalaa: More Than Just Coffee ☕️ Did you know the Oromo homeland is the birthplace of Arabica coffee? For the Oromo people, coffee (Buna) is not just a drink; it's a sacred ceremony that binds families and communities. The Buna Qalaa is a cherished ritual of hospitality and respect. The air fills with the sweet aroma of roasting beans, incense (ittana), and lively conversation. It's a slow, beautiful process where every step is deliberate and full of meaning. To be invited to a coffee ceremony is to be welcomed into the heart of an Oromo home. It’s a moment to share stories, blessings, and build connections. It is a true taste of Oromo hospitality! #Buna#CoffeeCeremony#OromoCulture#Hospitality#Community#Ethiopia#Africa http://T.me/etbisahusen

✈️ ETHIOPIAN AIRLINES: AFRICA'S AVIATION CHAMPION የኢትዮጵያ አየር መንገድ፡ የአፍሪካ የአየር ትራንስፖርት ጀግና Not just an airline - an EXPERIENCE at 35,000 feet! 🌍☕ ከአየር መንገድ በላይ - በ 35,000 ጫማ ላይ ልምድ! ━━━━━━━━━━━━━━━━ 🏆 AFRICA'S UNDISPUTED AVIATION HUB 🌍 THE NETWORK: • 130+ destinations across 5 continents • Africa's largest airline network • Addis Ababa = The Gateway to Africa • Direct flights: NYC, London, Beijing, Mumbai, São Paulo • "We connect civilizations!" ━━━━━━━━━━━━━━━━ 🇷🇺 ETHIOPIA ↔ RUSSIA: BRIDGE BETWEEN CIVILIZATIONS ኢትዮጵያ ↔ ሩሲያ፡ የስልጣኔዎች ድልድይ ЭФИОПИЯ ↔ РОССИЯ: МОСТ МЕЖДУ ЦИВИЛИЗАЦИЯМИ ✈️MOSCOW (SVO): 3-4 flights/week | ~7 hours | от $450 ✈️SAINT PETERSBURG (LED): Seasonal flights ለሩሲያውያን ጎብኝዎች: ✅ Visa on arrival (30 days!) ✅ Russian meals available ✅ Gateway to all East Africa ✅ Cheaper than via Dubai/Istanbul "От Москвы до Аддис-Абебы за 7 часов!" ❄️→☀️ ━━━━━━━━━━━━━━━━ ✈️ FLEET OF THE FUTURE: • 140+ modern aircraft (Boeing 787, Airbus A350) • Average age: 7 years (younger than most!) • First African airline with Dreamliner • Full Wi-Fi on international flights ━━━━━━━━━━━━━━━━ ☕ THE EXPERIENCE YOU'VE NEVER HAD 💎 ETHIOPIAN COFFEE CEREMONY AT 35,000 FEET! Imagine: You wake up from comfortable sleep... ✨ Open your eyes... 👀 And there she is - beautiful Ethiopian flight attendant in traditional habesha dress 👰 With jebena (ጀበና) filled with freshly brewed coffee ☕ She performs the ancient coffee ceremony... in the sky! 🌤️ THIS IS NOT A DREAM. THIS IS ETHIOPIAN AIRLINES.🔥 ይህ ህልም አይደለም። ይህ የኢትዮጵያ አየር መንገድ ነው። Only on Ethiopian Airlines: ✅ Traditional coffee ceremony on long-haul flights ✅ Fresh Ethiopian coffee (birthplace of coffee!) ✅ Served by crew in traditional attire ✅ The aroma of home at 35,000 feet ━━━━━━━━━━━━━━━━ 👰 BEAUTY & PROFESSIONALISM Ethiopian cabin crew - recognized worldwide: • Traditional habesha kemis with embroidery • Warm Ethiopian hospitality (የኢትዮጵያ እንግዳ መስተንግዶ) • Multilingual service • "Our crew welcomes you home" ━━━━━━━━━━━━━━━━ 💺 CLOUD NINE BUSINESS CLASS • Lie-flat seats (180° recline) • Ethiopian-inspired design • Authentic cuisine (injera, doro wat in the sky!) • Premium amenity kits • 1000+ entertainment options ━━━━━━━━━━━━━━━━ 💰 SMART PRICES Real examples: • Addis ↔ London: from $450 • Addis ↔ New York: from $650 • Addis ↔ Johannesburg: from $280 ShebaMiles: Earn miles on Star Alliance, upgrade to business, lounge access! ━━━━━━━━━━━━━━━━ 🌟 WHY WE LEAD AFRICA ✅ 4-star Skytrax (highest in Africa) ✅ "Best Airline in Africa" 2023 ✅ Star Alliance member ✅ Ethiopian-owned and operated (Africa's pride! 🇪🇹) ✅ 77+ years of excellence (since 1946!) "የአፍሪካ ኩራት በሰማይ" (Africa's pride in the sky) ━━━━━━━━━━━━━━━━ ✈️ FUN FACTS: 🤯 Only profitable airline in Africa for decades 🤯 Coffee ceremony by popular passenger demand! 🤯 Boeing 787 burns 20% less fuel (eco-friendly!) 🤯 Addis hub: 2,355m altitude - flight starts high! 🏔️ ━━━━━━━━━━━━━━━━ 📱 BOOK NOW: ethiopianairlines.com | 24/7 support | Digital boarding Pro tip: Book direct for best prices + full ShebaMiles! ━━━━━━━━━━━━━━━━ 🇪🇹 MORE THAN AVIATION 🌍 Connecting Africa to the world 💪 African excellence ☕ Ethiopian culture in the skies 🎓 Training Africa's next pilots "When you fly Ethiopian, you fly with Africa's best." ከኢትዮጵያ ጋር ስትበር፣ ከአፍሪካ ምርጥ ጋር ነው። ━━━━━━━━━━━━━━━━ Ready to experience aviation the Ethiopian way? ✈️☕ ━━━━━━━━━━━━━━━━ 🌍 ETHIOPIA | ЭФИОПИЯ | ኢትዮጵያ 📱 Join us: @ethiopia telegram #EthiopianAirlines#FlyEthiopian#AfricanAviation#CoffeeCeremony#AddisAbaba#EthiopianHospitality#Boeing787