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

TGINSIGHT SIMILAR POSTS

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

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

Наверняка вы замечали, что в Python есть удобная функция для получения переменной окружения os.getenv(NAME) И её "сестра" для создания или изменения переменных окружения os.putenv(NAME, VALUE) Но почему-то putenv() не работает как должно. Энвайромент не обновляется! os.putenv('MYVAR', '1') print(os.getenv('MYVAR')) ... и ничего 😴 Почему так? На самом деле энвайромент обновляется, но это значение не добавляется в словарь os.environ. Откройте исходник функции os.getenv(). Это просто шорткат для os.environ.get() В то время как putenv() это built-in С-функция. Словарь os.environ (или точней класс из MutableMapping) создаётся из энвайромента в момент инициализации. Функция putenv() самостоятельно его не изменяет. В тоже время, когда вы создаёте или изменяете ключ в os.environ, автоматически вызывается putenv() в методе __setitem__(). То есть, технически putenv() всё делает верно, но в os.environ это не отражается. Можно проверить так: >>> os.putenv('MYVAR', '123') >>> os.system('python -c "import os;print(os.getenv(\'MYVAR\'))"') 123 Я объявил переменную в текущем процессе и вызвал дочерний процесс, который её унаследовал и получил в составе os.environ. Аналогично при удалении переменной вызывается еще одна built-in функция unsetenv(), удаляющая переменную из системы. Итого ▫️ Удобней всего явно обновлять переменные через os.environ ▫️ Есть способ неявно создать/удалить переменную через putenv/unsetenv, что не повлияет на os.environ но изменит энвайромент и передаст изменения сабпроцессам. Но так лучше не делать! ▫️os.environ это просто обертка для built-in функций putenv() и unsetenv(). #basic

Hashtags

Резултати

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

Пребарај: #december

当前筛选 #december清除筛选
iDubTG

@idubtg · Post #458 · 29.12.2023 г., 10:31

Bot API 7.0 Announcing our biggest Bot API update yet! Reactions • Introducing full reaction support for bots. • Bots can now react to messages with setMessageReaction. • Message reactions now generate updates for bots. • Added the available_reactions field to the class Chat. Replies 2.0 • Bots can now reply to messages in other chats or topics. • Added the ExternalReplyInfo class, to track replies across chats. • The new class ReplyParameters replaces individual reply options in all relevant methods and lets bots quote parts of any message. • The new field quote of the class Message lets bots detect incoming quoted text. Link Preview Customization • Bots can now set a custom URL to generate link previews in outgoing messages. • Added support for custom size and position of link previews. • Added the class LinkPreviewOptions to support these new options. Batch Actions • Bots can now delete multiple messages in a single request via deleteMessages. • Bots can now forward or copy multiple messages in a single request via the respective forwardMessages and copyMessages methods. Boosts & Giveaways • Added support for Giveaway messages, allowing bots to detect their creation and completion. • Added updates about chat boost changes via the new classes ChatBoostUpdated and ChatBoostRemoved. • Bots can now see if a boost came from a premium sub, a gift code, or a giveaway, as well as check all active user boosts via getUserChatBoosts. General •Blockquotes are now supported in MarkdownV2 and HTML parse modes. • Web Apps won't close when calling openTelegramLink. • Web Apps can now toggle the visibility and on-click behavior of the Settings Button. • Bots can now request multiple users, see KeyboardButtonRequestUsers. • The class Chat has new fields holding profile and background colors, custom emoji, and more. • And a great deal more. See the full changelog for details: https://core.telegram.org/bots/api-changelog#december-29-2023 Happy Holidays from the Telegram Team 🎆

Hashtags

APKPure_Official

@apkpurechannel · Post #2788 · 13.12.2025 г., 11:00

🆓REDEEM CODES🆓 🚀AFK Arena New #Codes [#December 2025] 👉Code:【 u4fctemje2 】 🎁Gift: 1k diamonds and multiple eight-hour boosts For your convenience, we have arranged all new working AFK Arena codes. Go to 🔗AFK Arena Redeem Code (Complete List) for a batch of active redeem codes. Add @APKFreeDownloader_Bot to get any apk you want.

悦读「优质少量RSS聚合」

@Dailyrss · Post #13205 · 21.12.2025 г., 00:45

Wikipedia每日一图(#December 21, 2025)https://ift.tt/3A18ovM View of coastline northwest from above Manarola: fields and steep trail to Volastra in foreground, Corniglia Station and town centre, north to Punta Mesco. Depicts the north half of Cinque Terre National Park coastline. Liguria, Italy. 了解更多 . #Wikipedia每日一图

123•••67
ПретходнаСтраница 1 од 7Следна