I'm trying to pass a parameter (directory) to a %cd command in ipython notebook as below:
rootdir = "D:\mydoc"
%cd rootdir
but i get the following error:
[Error 2] The system cannot find the file specified: u'rootdir'
D:\mydoc
when i'm doing
%cd D:\mydoc
This obviously works but i want to be able to specify my working directories using parameters...
Many thanks who can help me.
Best Wishes
You can use $
to use the value in a variable.
%cd $rootdir
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With