Skip to content

Instantly share code, notes, and snippets.

@srinivasreddy
Created January 12, 2018 02:09
Show Gist options
  • Save srinivasreddy/29a4ee8a1bc25ed9171b8cb1aeaaafb0 to your computer and use it in GitHub Desktop.
Save srinivasreddy/29a4ee8a1bc25ed9171b8cb1aeaaafb0 to your computer and use it in GitHub Desktop.
cargo git:(master) echo $NAME
➜ cargo git:(master) export NAME='Srinivas'
➜ cargo git:(master) echo $NAME
Srinivas
➜ cargo git:(master) python
Python 2.7.12 (default, Nov 20 2017, 18:23:56)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import o
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named o
>>> import os
>>> print os.environ.get('NAME')
Srinivas
>>> print os.environ.get('LAST_NAME')
None
>>> print os.environ.get('LAST_NAME', 'Reddy')
Reddy
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment