I have a cell with this content:
import os
os.mkdir('123')
name = '123'
!rm -r name
I want to pass the value of the variable name to the last line. How can I do this?
I have a cell with this content:
import os
os.mkdir('123')
name = '123'
!rm -r name
I want to pass the value of the variable name to the last line. How can I do this?
Try $
. It will substitute the python variable.
!rm -r $name
You may need to use $name\.txt
or {name}.txt
in some cases.
Use {}
.
myvar = "/test"
!cd {myvar}