5

I want to list out all the environment variables in my system in python. The list should give me the name of the variable and its value.

1

1 Answer 1

10

Using os module of python it is possible to list out the environment variables.

import os

for name, value in os.environ.items():
    print("{0}: {1}".format(name, value))
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.