默认情况下,echo = False [英] echo=False by default in pweave
本文介绍了默认情况下,echo = False的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当使用pweave处理python脚本文件时,如何默认将标志echo = False设置为所有代码.
How can I set the flag echo=False by default to all code, when precessing a python-script file with pweave.
最小示例:
#' # Minimal example.
#' This is a minimal example, which
#' says 'hello' to you.
#+ echo=False
print('Hello')
#' The end.
由哪个处理
# either: py to html
pypublish test.py
# or: py to markdown
pweave -f pandoc test.py
推荐答案
在文档的开头添加以下几行: 1.将第一个代码块的echo设置为false,然后将其他每个代码块的echo更改为false. 2.您可以查看文档 http://mpastell.com/pweave/defaults.html
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!"})
在文档之后,您还可以更改其他参数,我从文档中选择了"f_pos".
Following the documentation you can also change other parameters, I have picked 'f_pos' from documentation.
这篇关于默认情况下,echo = False的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文