%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

testing - Detect whether test has failed within fixture -

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

android - Create single AAR file from multiple modules using Gradle -