IPython is a neat alternative of Python's builtin REPL (Read–Eval–Print Loop) interpreter, also a kernel of Jupyter.
# cheatsheet %quickref # show details of any objects (including modules, classes, functions and variables) random? os.path.join? some_variable? # show source code of any objects os.path.join?? # show nothing for a function that is not implemented in Python len?? # run some shell commands directly in IPython pwd ll cd cp rm mv mkdir new_folder # run any shell command with ! prefix !ls !ping www.google.com !youtube-dl # assign command output to a variable contents = !ls print(contents)
# list all magic functions %lsmagic # run a Python script and load objects into current session %run my_script.py # run a profiling for multi-line code %%timeit array =  for i in xrange(100): array.append(i) # paste multi-line code %paste %cpaste # explore objects %pdoc some_object %pdef some_object %psource some_object %pfile some_object # if you call it after hitting an exception, it will automatically open ipdb at the point of the exception %debug # the In object is a list which keeps track of the commands in order print(In) # the Out object is a dictionary mapping input numbers to their outputs pinrt(Out) print(Out, _2)