1

我在 repl.it 上使用 python3。我试图打印退格,但它打印而不是print("hello\bworld")应该打印hellworld,但它打印helloworld。我尝试使用sys.stdout.write("\b"),但它仍然打印
有人可以帮忙吗?

4

1 回答 1

0

使用repr. repl.it使用浏览器渲染字符。如果您比较输出中的字符数(例如,通过使用 Chrome 的 JS 控制台),您会看到print('abc')print('a\bc').

于 2018-06-06T19:07:20.710 回答