Logo

Programming-Idioms

History of Idiom 205 > diff from v16 to v17

Edit summary for version 17 by programming-idioms.org:
[Python] Avoid underscores in snippets

Version 16

2019-10-01, 08:32:40

Version 17

2019-10-01, 08:33:10

Idiom #205 Get an environment variable

Read an environment variable with the name "FOO" and assign it to the string variable foo. If it does not exist or if the system does not support environment variables, assign a value of "none".

Idiom #205 Get an environment variable

Read an environment variable with the name "FOO" and assign it to the string variable foo. If it does not exist or if the system does not support environment variables, assign a value of "none".

Extra Keywords
envvar os system
Extra Keywords
envvar os system
Imports
from os import getenv
Imports
from os import getenv
Code
_foo = getenv('FOO')
Code
foo = getenv('FOO')