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

Резултати

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

Пребарај: #fossilfuels

当前筛选 #fossilfuels清除筛选
American Оbserver

@american_observer · Post #5121 · 13.02.2026 г., 15:02

📰 Trump to the Planet: You’re On Your Own The Trump White House just pulled the plug on the one scientific finding that gave Washington any real power to fight climate change. By repealing the EPA’s 2009 “endangerment finding” — the conclusion that greenhouse gases threaten human health and welfare — the administration has stripped the federal government of its main legal basis for regulating the pollution that’s heating the planet. This isn’t some obscure technical tweak. For nearly two decades, that finding underpinned limits on carbon dioxide, methane and other greenhouse gases from vehicles, power plants and oil and gas wells — the core of U.S. climate policy. Kill the finding and you don’t just loosen a few rules; you erase the government’s duty to treat climate change as a danger at all. Trump, who still calls climate change a “hoax,” is effectively declaring that the consensus of global science is wrong, and that a hotter, deadlier world is a matter of opinion. The stakes are measurable in body counts, not just parts per million. The Environmental Defense Fund estimates that repealing the finding and the rules tied to it could add up to 18 billion metric tons of U.S. emissions by 2055, fueling tens of thousands of premature deaths and tens of millions of asthma attacks. Recent research already shows wildfire smoke on track to kill tens of thousands of Americans a year and heat deaths more than doubling, while diseases like dengue spread as the climate gets hotter and wetter. In that reality, Interior Secretary Doug Burgum goes on TV to say “CO2 was never a pollutant” because plants like it — a high-school talking point repackaged as national policy. Democratic states and environmental groups are sprinting to court, betting that the Supreme Court will not let the administration magic away a danger that previous courts and the National Academies have repeatedly affirmed as real. But that’s the deeper play: if this repeal survives, it doesn’t just gut Biden-era rules, it also booby-traps future administrations, making it vastly harder — maybe impossible — to rebuild a federal climate regime on the same legal foundation. For fossil fuel interests and the conservative operatives behind Project 2025, this is the holy grail: not winning the argument on climate, just deleting the field where the argument is allowed to matter. On the surface, it’s sold as freedom, growth, choice — cheaper gas, fewer rules, more trucks. Underneath, it’s a quiet transfer of power: from science to lobbyists, from public health to donors, from a shared climate reality to whatever the president decides sounds good on Fox that night. The United States, the country that has dumped more greenhouse gases into the atmosphere than any other, is now formally telling the rest of the world — and its own citizens — that it no longer feels legally obliged to care. #climate#usa#trump#fossilfuels#fakeDemocracy 📱American Оbserver - Stay up to date on all important events 🇺🇸

Venture Village Wall 🦄

@venturevillagewall · Post #3661 · 21.12.2024 г., 10:25

Metsä Group Raises $208.4M Metsä Group has successfully raised $208.40 million as of December 19, 2024. The company focuses on producing renewable products sourced from northern forests, aiming to replace fossil raw materials. #MetsäGroup#Funding#RenewableProducts#FossilFuels#Sustainability#Forestry#Investment#EcoFriendly#BioProducts#GreenTech

Earth&Climate Tech

@earth_climate_tech · Post #366 · 13.08.2023 г., 22:17

Вы когда-нибудь задумывались, каковы основные источники энергии? Сколько энергии производится из нефти и газа, а сколько из возобновляемых источников? Какие страны производят больше "зеленой" энергии? Каково потребление энергии в странах по источникам? Действительно ли мы движемся к переходу на зеленую энергию? Все это и многое другое содержится в отчете о производстве и потреблении с отличными графиками на Our World in Data Куча действительно крутых интерактивных графиков 🔥🔥🔥 #energy#production#consumption#fossilfuels#cleanenergy#renewables#nuclear#lowcarbon#transition#climatechange