python IDLE shell appears not to handle some escapes correctly

一笑奈何 提交于 2019-12-17 21:37:02

问题


For example \b backspace prints as quad (shown as [] in example below). But \n newline is Ok.

>>> print 'abc\bd'
abc[]d
>>> print 'abc\nd'
abc
d

Im running under Vista (pro), python 2.7

Ive tried googling this issue generally and in SO and cant find anything relevant, which seems odd and makes me wonder if theres some setting or other may be wrong in my setup. Not sure what to look for.


回答1:


What am I doing wrong or what should I be looking for?
Is it reasonable to expect backspace, specifically, to work?

No, IDLE does not support backspace, nor carriage-return, nor formfeed, nor ANSI escape sequences.

You are expecting \b to move the cursor one cell to the left in IDLE's interactive shell window. It doesn't do that. IDLE does not support cursor addressing in its shell window, with the exception of newline and tab.



来源:https://stackoverflow.com/questions/20637122/python-idle-shell-appears-not-to-handle-some-escapes-correctly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!