Unable to make IPython to read shell variables
-
21-08-2019 - |
Question
I run the command in IPython
cd $cs<TAB>
but it does not allow me to expand the path.
How can you make IPython to read shell variables?
Solution
If i understand correctly what you mean by 'shell variables'. If you mean variables set in the shell ('environment variables'): you can read them with os.environ...
import os
cs = os.environ.get('cs')
runstring = "cd %s" (cs)
...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow