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

Резултати

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

Пребарај: #examples

当前筛选 #examples清除筛选
Go

@golang · Post #33 · 03.02.2018 г., 16:59

The time for fun 🙂 one of the Github users, Sau Sheong Chang (sausheong) ported and build the arcade video game calls ‘Space Invaders’ using GoLang and wrote step-by-step instructions to repeat it. Enjoy a good nostalgy post with code examples, source code, and demo =) #development#examples https://github.com/sausheong/invaders/blob/master/README.md Source code here https://github.com/sausheong/invaders

Go

@golang · Post #63 · 10.06.2018 г., 21:09

GoLang + Apache Kafka + Amazon Dynamo DB = ? A quick-readable article about interesting way of a service architecture (eg. LocationRepository here is). Also in the end of this article you’ll find good links for further reading 😉 #architecture#examples#development https://medium.com/@self.maurya/building-a-microservice-with-with-golang-kafka-and-dynamodb-part-i-552cc4816ff

Go

@golang · Post #19 · 22.01.2018 г., 21:32

Do you think about gRPC usage? Here is a great post about step-by-step guide to gRPC framework development. You’ll find here code examples, theory introductions and useful tips. Enjoy learning! 🙂 #manual#development#microservices#examples https://medium.com/@shijuvar/building-high-performance-apis-in-go-using-grpc-and-protocol-buffers-2eda5b80771b?source=linkShare-b636419a57de-1516656055

GitHub Trends

@githubtrending · Post #15130 · 09.09.2025 г., 11:30

#typescript#examples#nextjs#vercel Vercel offers ready-to-use templates and examples that help you quickly start web projects with best practices and optimized settings, especially for frameworks like Next.js. These templates save you time by handling setup and deployment details, letting you focus on coding. You can also contribute your own examples easily using provided commands and guidelines. Vercel automatically checks your code style and quality before commits, ensuring clean code. Plus, it integrates with Git and runs tests before deployment to catch bugs early. This makes building, deploying, and maintaining fast, reliable web apps much easier and faster for you. https://github.com/vercel/examples

djangoproject

@djangoproject · Post #261 · 16.02.2017 г., 06:56

http://www.giantflyingsaucer.com/blog/?p=5557 In spring 2014 Python 3.4 shipped a provisional package (#asyncio) which according to the docs “provides infrastructure for writing single-threaded #concurrent code using #coroutines, #multiplexing I/O access over #sockets and other resources, running network clients and servers, and other related primitives“. I can’t possibly cover everything in this article but I can introduce some of the things you can do with it. As per my New’s Years resolution I’ll be building these #examples using Python 3.4.2 (Asyncio has been ported back to Python 3.3 now as well).

BotsGram®

@botsgram_cu · Post #3413 · 21.01.2021 г., 11:00

@lingvanexbot Qué puede hacer este bot? Este es un bot traductor de alta calidad basada en redes neuronales para más de 50 idiomas. ➕ Traducir cualquier texto o palabras ➕ Convertir texto a voz ➕ Dar definiciones para cualquier palabra ➕ Diccionario ➕ Buscar por ejemplos de traducciones Idioma: Múltiple (visto en @BotsGram_cu) #linguistic, #translate, #define, #dictionary, #dict, #text2speech, #speech, #examples, #sentence, #words

GitHub Trends

@githubtrending · Post #15000 · 27.07.2025 г., 12:00

#markdown#android#bsd#cheatsheet#cheatsheets#command_line#console#documentation#examples#hacktoberfest#help#linux#macos#man_page#manpages#manual#osx#shell#terminal#tldr#windows The tldr-pages project offers simple, easy-to-understand help pages for command-line tools, focusing on practical examples rather than long, complex manuals. It’s great if you’re new to the command line or forget command options, as it shows the most useful commands clearly. You can access these pages through various clients or online without installing anything. This saves you time and frustration by giving quick, clear guidance on common tasks, making it easier to learn and use command-line tools effectively. Plus, you can contribute by adding or improving pages yourself. This helps you and others get fast, practical help with commands[1][4]. https://github.com/tldr-pages/tldr