Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5f697c4

Browse files
Merge pull request #3 from sethiojas/feature/GetEnvironmentVariable
snippet to get the value of an environment variable
2 parents b37f92b + 880eee3 commit 5f697c4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Get a Specific Environment Variable
2+
*tags:* **os, python**
3+
4+
`os` is a built-in python module to interact with the operating system.
5+
6+
**Snippet**
7+
```python
8+
import os
9+
10+
# This is the environment variable that would be fetched.
11+
# For example here we are getting the 'Path' environment
12+
# variable
13+
env_var = 'Path'
14+
15+
# fetched_result variable holds the value
16+
# which was to be retrieved
17+
fetched_result = os.environ[env_var]
18+
19+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /