Re: Can I interpolate python variables into cell magics?
Le 16 avr. 2014 à 09:52, Patrick Surry a écrit :
> This seems like a stupid question, but if I'm using a cell magic like %%html or %%writefile, is there any way I can interpolate
> data from notebook variables into the cell? A kind of macro substitution if you will.
IIRC, this only work on the first line of the cell for these magics.
But I think you can write a magic that uses @needs_local_scope and then access the local scope with
self._magic_locals then format the string by your self.