Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

echo=False by default in pweave

How can I set the flag echo=False by default to all code, when precessing a python-script file with pweave.

Minimal example:

#' # Minimal example.

#' This is a minimal example, which
#' says 'hello' to you.

#+ echo=False
print('Hello')

#' The end.

Which gets processed by

# either: py to html
pypublish test.py

# or: py to markdown
pweave -f pandoc test.py
like image 807
Thomas Möbius Avatar asked Oct 27 '25 10:10

Thomas Möbius


1 Answers

Include the following lines at the very beginning of your document: 1.set the echo false for the first code chunk and then change it to false for every other code chunk. 2.You can have a look in the documentation http://mpastell.com/pweave/defaults.html

#+ echo = False
import pweave
pweave.rcParams["chunk"]["defaultoptions"].update({'echo' : False,
'f_pos' : "h!"})

Following the documentation you can also change other parameters, I have picked 'f_pos' from documentation.

like image 82
thedarkgriffen Avatar answered Oct 30 '25 00:10

thedarkgriffen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!