This is a normal python block using the pycod environment
print('pycod')
Hidden execution cells (pyhid, pycod-e) can be used to perform operations (e.g. imports, variable initializations) without showing any cell.
The pyhid environment executes and hides the cell in formats other than .ipynb:
The pycod-e environment executes but hides the cell also in .ipynb files:
import os
os.listdir(".")
a = 1
pycod is a normal cell that should execute automatically when using --execute. Note that this cells relies on code executed in a previous hidden cell:
print(sys.version)
b =2
c = a + b
print("The result is {}".format(c))
c
The *-t environment (e.g. pycod-t) formats a cell to text, and can be used to print an example
# This is a for-loop examplefor i in [0,10]:
print(i)
The *out (e.g. pycod-out) environment can be used to write a cell output:
# This is a normal pycod cell1/0
1/0: You cannot divide by zero
The -h postfix can be used in the html format to show a Show/Hide button that toggles the code visibility.
print('show/hide')
Plotting
This is a cell that should plot and output:
frompylabimport*
x = linspace(0, 10, 100)
plot(x, x*x)
show()
To improve quality when exporting to LaTeX, the following code has automatically
been run to enable PDF export in notebooks.