Reputation: 3325
I understand !
tells iPython to treat the expression as "Bashy", but how do I tell iPython to treat an expression as "Pythony" so I can mix the two together?
For example, if I have a list of folders, how do I cd
into them by indexing into the list?
In [57]: x = !find . -type d
In [58]: !cd x[-1]
sh: line 0: cd: x[-1]: No such file or directory
iPython is not making the substitution for x[-1]
Upvotes: 2
Views: 189
Reputation: 10450
!cd {x[-1]}
If you want change current dir of ipython:
cd {x[-1]}
Upvotes: 4