%run Python function in IPython -
i'd run function ipython , load of data interactive namespace, how %run filename.py
it. e.g., here's file scratch.py
:
def foo(x): = x*2
in ipython, i'd run function , able access name a
. there way this?
in order make variable available globally (or in interactive ipython session), first have define global:
def foo(x): global = x*2
otherwise a
remains local variable within function. more infos e.g. here: use of “global” keyword in python
Comments
Post a Comment