Skip to content

Instantly share code, notes, and snippets.

@fepegar
Created June 25, 2025 20:07
Show Gist options
  • Save fepegar/6b576276ba331124a6fe5c671fd61239 to your computer and use it in GitHub Desktop.
Save fepegar/6b576276ba331124a6fe5c671fd61239 to your computer and use it in GitHub Desktop.
Print environment variables.
import os
longest_env_var = max(os.environ, key=lambda k: len(k))
for k in sorted(os.environ):
padded = k.ljust(len(longest_env_var), ".")
print(f"{padded} {os.environ[k]}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment