%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

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -