Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Jupyter笔记本输入字段出现在错误的位置_Python_Jupyter Notebook - Fatal编程技术网

Python Jupyter笔记本输入字段出现在错误的位置

Python Jupyter笔记本输入字段出现在错误的位置,python,jupyter-notebook,Python,Jupyter Notebook,在Jupyter笔记本中,我运行以下命令 print("The input field should appear below this line") input() 我希望得到一行文本,后跟一个输入字段。但有时我会得到相反的结果。如何强制它以正确的顺序出现?功能将文本发送到系统的标准输出缓冲区。然后,系统决定何时将缓冲区中的内容推送到前端。在您的情况下,这偶尔会发生在输入请求之后。通过将flush=True作为关键字参数添加到print函数,可以告诉系统“立即推送输出” print("The

在Jupyter笔记本中,我运行以下命令

print("The input field should appear below this line")
input()

我希望得到一行文本,后跟一个输入字段。但有时我会得到相反的结果。如何强制它以正确的顺序出现?

功能将文本发送到系统的标准输出缓冲区。然后,系统决定何时将缓冲区中的内容推送到前端。在您的情况下,这偶尔会发生在
输入请求之后。通过将
flush=True
作为关键字参数添加到
print
函数,可以告诉系统“立即推送输出”

print("The input field should appear below this line", flush=True)
input()
此外,您还可以让
输入
打印一行文本

input("The input field appear next to this line: ")

谢谢不幸的是,法拉盛夸格似乎对我没有任何影响。