简体   繁体   English

在Spyder Ipython控制台中从剪贴板粘贴并执行多行

[英]Paste and Execute Multiple Lines from Clipboard in Spyder Ipython Console

I would like to paste the following code into the ipython console in spyder (ie directly from the clipboard to the console) 我想将以下代码粘贴到spyder的ipython控制台中(即直接从剪贴板复制到控制台)

nsample = 100
x = np.linspace(0, 10, 100)

在此处输入图片说明

I've pasted the 2 lines into the Ipython console in Spyder in the image above. 我已将两行粘贴到上图中Spyder的Ipython控制台中。 How could I then execute the 2 lines shown in the console window from spyder? 然后如何从spyder执行控制台窗口中显示的2行? Everytime I press enter it just inserts a new line with a "...:" prompt. 每次按Enter时,它只会在提示符“ ...:”处插入新行。

Additionally, I see that Spyder doesn't let me use the %paste command. 此外,我发现Spyder不允许我使用%paste命令。 Is there a workaround for this? 有没有解决方法?

You need to press SHIFT+Enter to tell the interpreter you have entered all the commands. 您需要按SHIFT + Enter告诉口译员您已经输入了所有命令。 The "..." means the interpreter expects you to enter more commands. “ ...”表示解释器希望您输入更多命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM