TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #191 · 14 дек.

Как разделить строку с shell-командой на отдельные аргументы в виде списка? Если сделать просто сплит по пробелу то получим то что надо, кроме случаев со вставками текста с пробелами. Например так: >>> '-arg "I Am Groot"'.split(' ') ['-arg', '"I', 'Am', 'Groot"'] Чтобы учитывать текст в кавычках как единый аргумент можно воспользоваться функцией shlex.split() Кто читает мой канал давно, уже в курсе. А что делать, если нужно обратное действие? Объединить аргументы из списка в строку и при этом добавить кавычки в аргумент с пробелами. Конечно, если вы используете subprocess то он сам всё разрулит. Но если вам нужна именно команда одной строкой, то можно воспользоваться готовой функцией в том же subprocess. >>> from subprocess import list2cmdline >>> list2cmdline(['-arg', 'I Am Groot']) '-arg "I Am Groot"' Он также позаботится об экранировании уже имеющихся кавычек >>> list2cmdline(['-arg', 'I Am "Groot"']) '-arg "I Am \"Groot\""' А вот так он может "схлопнуть" в команду JSON >>> list2cmdline(['--json', json.dumps({'key': 'value'})]) '--json "{\"key\": \"value\"}"' _______________ Возможно кто-то спросит, а зачем соединять аргументы в строку если subprocess сам это сделает а os.system не наш путь? Мне как-то потребовалось отправлять команду на удалённое выполнение и в API поддерживалось указание команды только строкой. Так что всякое бывает) #libs#basic

Hashtags

Резултати

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

Пребарај: #coffeeculture

当前筛选 #coffeeculture清除筛选

☕🍫 ETHIOPIA'S GOLDEN OPPORTUNITY The Coffee Paradox and the Cocoa Revolution That Never Happened 🌍COFFEE WORTH ITS WEIGHT IN GOLD Ethiopian coffee is not just a beverage. It's liquid history. Hand-picked at dawn, processed by generations of knowledge, grown in the birthplace of coffee itself — the highlands where the first beans were discovered over 1,000 years ago. This coffee should cost like gold. Because it IS gold. Specialty Ethiopian coffee: \$40-100 per kilogram. Single-origin Yirgacheffe, Sidamo, Harrar — these names are revered in specialty coffee circles worldwide. Roasters in Tokyo, London, New York pay premium prices for these beans. ይህ ቡና ወርቅ ነው። በእጅ የተሰበሰበ፣ በትውፊት የተቀነባበረ፣ በወርቅ ዋጋ መሸጥ አለበት። (This coffee is gold. Hand-picked, traditionally processed, it should sell at gold's price.) But here's the brutal truth: In the mass market — supermarkets, chain cafés, everyday consumption — Ethiopia struggles to compete with Brazil, Colombia, Vietnam. Not because our coffee is inferior. But because Western producers mastered marketing decades ago. They built brands. Created stories. Dominated distribution. Эфиопский кофе проигрывает не по качеству, а по маркетингу. (Ethiopian coffee doesn't lose on quality, but on marketing.) --- 🍫THE COCOA BOOM THAT PASSED US BY While Ethiopia focused on coffee, something extraordinary happened in West Africa. The global cocoa market exploded. 2024 cocoa prices: \$10,000+ per ton — a historic record. Demand is surging. Chocolate consumption in Asia, artisan chocolate movement in the West, premium dark chocolate market — the world cannot get enough cocoa. Who's winning? Côte d'Ivoire, Ghana, Cameroon. They produce 70% of the world's cocoa. African nations dominate the market. Production is expanding. Farmers are profiting. Economies are growing. የአፍሪካ አገሮች የአለምን ካካኦ 70% ያመርታሉ። ዋጋው እየጨመረ ነው። ግን ኢትዮጵያ የት ነች? (African countries produce 70% of world's cocoa. Prices are rising. But where is Ethiopia?) Ethiopia's cocoa production? Virtually zero. Давайте повторим: практически ноль. (Let's repeat: practically zero.) --- 🌱THE MADNESS OF MISSED OPPORTUNITY Here's what makes this absurd: Ethiopia has PERFECT conditions for cocoa cultivation. Southwestern Ethiopia — regions like Bench Maji, Kaffa (yes, the birthplace of coffee!), and Gambella — share the exact same climate as Ghana and Côte d'Ivoire: - Tropical highland climate - Rich volcanic soil - Consistent rainfall - Temperature range 18-32°C We have everything: - ✅ The land - ✅ The farmers with agricultural expertise - ✅ The climate - ✅ The infrastructure potential ኢትዮጵያ ለካካኦ ምርት ፍፁም ሁኔታ አላት። አፈር፣ የአየር ሁኔታ፣ ገበሬዎች። ሁሉም ነገር ዝግጁ ነው። (Ethiopia has perfect conditions for cocoa production. Soil, climate, farmers. Everything is ready.) What we DON'T have: Production scale. Market presence. Investment in cocoa farming. --- 💎THE DUAL STRATEGY: LUXURY + OPPORTUNITY The solution isn't abandoning coffee. It's strategic diversification. COFFEE: Position Ethiopia as the ultra-premium, luxury origin. Not mass market — leave that to Brazil. Ethiopian coffee should be what Champagne is to wine. What Kobe beef is to meat. Exclusive. Prestigious. Worth the price. COCOA: Seize the African cocoa boom. West Africa showed the way — now it's Ethiopia's turn. Start cocoa cultivation in suitable regions. Partner with international chocolate makers. Create Ethiopian chocolate brands. Эфиопия может быть и родиной кофе, и новым лидером по какао. Две золотые культуры. (Ethiopia can be both the birthplace of coffee and a new cocoa leader. Two golden crops.) --- Ethiopia: birthplace of coffee, future of African cocoa. ወርቅ እና ቸኮሌት። (Gold and chocolate.) #EthiopianCoffee#CocaoOpportunity#AfricanAgriculture#Ethiopia#CoffeeCulture#CocaoBoom#Agribusiness🌍☕🍫