Jupyter: Show contents of external script

less than 1 minute read

%pycat shows you (in a popup) the syntax highlighted contents of an external file:

> %pycat pythoncode.py

import numpy
def append_if_not_exists(arr, x):
    if x not in arr:

def some_useless_slow_function():
    arr = list()
    for i in range(10000):
        x = numpy.random.randint(0, 10000)
        append_if_not_exists(arr, x)

Via dataquest.io.