Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'\b' doesn't print backspace in PyCharm console

I am trying to update the last line in PyCharm's console. Say, I print a and then I want to change it to c. However, I encounter the following problem. When I run:

print 'a\bc'

it prints

a c

while the desired output (which is also what I see in the Windows console) is:

c

Is there a way to move the cursor back in PyCharm's console? or maybe delete the whole line?

like image 636
Yariv Avatar asked Nov 12 '13 09:11

Yariv


People also ask

How do I enable console in Pycharm?

In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Build, Execution, Deployment | Console | Python Console. Select any available interpreter from the Python interpreter list.

Why is Pycharm printing none?

Because your toString() method does not return anything it just prints the string. When a method does not return anything , by default it's return value is None , and this is the reason when you do 'print(cat. toString())' , you print None , which is the return value of your method .


1 Answers

This is not a bug, this is a limitation of the interactive console found both in PyCharm, and in the IDLE shell.

When using the command prompt of windows, or a linux shell - the \b character is interpreted as a backspace and implemented as it is being parsed - However, in the interactive console of PyCharm and IDLE the \b character and many others are disabled, and instead you simply get the ASCII representation of the character (a white space in most cases).

like image 86
Inbar Rose Avatar answered Oct 10 '22 02:10

Inbar Rose