【问题标题】:Twill causing print() not to show斜纹导致 print() 不显示
【发布时间】:2021-04-19 04:05:35
【问题描述】:

我正在尝试将 Twill 与 Jupyter/Python 一起使用。但是,如果我在导入斜纹之后使用 Print(),例如。

from twill.commands import go, showforms, formclear, fv, submit, show

print("hi") 

它不会打印任何东西。

这是正常行为吗?

这发生在 google colan 和 jupyterLab 上

【问题讨论】:

  • 刚试了一下,print('hi')没有输出

标签: python pandas twill


【解决方案1】:

您的模块可能有自己的 sys 模块,这在导入时会导致 Jupyter 出现问题。

试试这个:

from twill.commands import go, showforms, formclear, fv, submit, show
import sys

sys.stdout = stdout

print ('hi')

否则,我只是建议永远不要使用那些在线笔记本,在我看来,这些笔记本本质上是有限的,因为由于缺乏与主要 Python 相关的文档,因此难以解决意外行为。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-22
    • 1970-01-01
    • 2014-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多