用“tab”缩进python 命令行中的按钮

发布于 2024-10-21 14:08:56 字数 319 浏览 5 评论 0原文

大家好 :) 我的问题是,到目前为止,我只使用制表符来缩进Python,因为我发现它比空格更容易,但我不知道为什么,Python交互式提示符,基本的python.exe,突然拒绝接受制表符按钮,它所做的只是闪烁光标。我能想到的是,我的计算机突然像其他窗口一样踩着窗口,使用选项卡循环输入内容,在本例中是单个输入。另外,在此之前,我可以使用向上按钮访问之前输入的代码,如果我提交该行而不进行任何更改,请使用向下按钮访问它后面的行,但现在向上按钮可以工作,但就好像我有更改了行,例如将我移回输入列表的“底部”,因此向下不起作用......我的问题只是:如何让我的旧选项卡和向下按钮像我想要的那样工作他们又来了? :( 谢谢xxx

hi everyone :)
my problem is, up until now, i have exclusively used tabs to indent python, as i find it easier than spaces, but for no reason i know, python interactive prompt, the basic python.exe one, suddenly refuses to accept the tab button, all it does is flash the cursor. all i can think of is that my computer in suddenly treading the window like any other, using tab to cycle input things, in this case the single one. also, before now, i could use the up button to reach previously typed code, the if i submit that line with no changes, use the down button to access the line that came after it, but now up works, but as if i had changed the line, eg moves me back to the "bottom" of the list of inputs, so down doesn't work.... my question simply is: how do i get my good old tab and down button to work like i want them to again? :(
thanks xxx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

寂寞美少年 2024-10-28 14:08:56

如果您使用带有标准 cmd.exe 控制台的 Windows(并且提前说明这一点会对您有所帮助),那么您可以完全按照您的意愿使用 TAB 和箭头键。

If you are using Windows with the standard cmd.exe console (and it would have been helpful for you to have stated this up front) then you can use the TAB and arrow keys exactly as you desire.

§对你不离不弃 2024-10-28 14:08:56

我最近也在 Windows 上使用 cmd.exe 观察到了这种行为。 Console2(我有时使用的替代 shell)也会发生这种情况。

尽管我总是在编辑器中的普通代码中使用空格,但我已经习惯于在交互式 python.exe 解释器中使用 Tab 键缩进简短的多行输入。最近停止工作 - 按 Tab 键会使光标闪烁并且不缩进。在这里使用空格确实可以很好地工作,尽管经过几个缩进后就不太方便了。

我怀疑(但不确定)原因是安装了 pyreadline 或 rlcompleter - 我一直在尝试在 Windows 上的嵌入式应用程序的解释器中获取制表符补全。当然,在您的情况下,另一个安装可能包含这些软件包。

I recently observed this behavior too, on Windows, using cmd.exe. It also happens with Console2 - an alternate shell I sometimes use.

Though I do always use spaces in normal code in an editor, I had been accustomed to using the Tab key to indent in short multi-line inputs in the interactive python.exe interpreter. Recently that stopped working - pressing the Tab key flashes the cursor and doesn't indent. Using spaces does work fine here, though it's not as convenient past a couple of indentations.

I suspect (but am not certain) that the cause was installation of pyreadline or rlcompleter - I had been messing with trying to get tab completion in an interpreter in an embedded application on Windows. Of course in your case another installation could have included those packages.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文