In python carriage return \r returns a musical note

点点圈 提交于 2019-12-13 00:45:25

问题


print "-------------------\r"

produces a musical note instead doing the carriage return. Why?

Thanks in advance for reply.

EDIT: I was using it in this code in order to change dinamically data by 'print' instead to re-print it all:

import math
import time

    while True:
        reading = read_world_2c(0x43) #it's a function for reading data from a sensor
        print "data:     \r", reading
        time.sleep(0.5) 

回答1:


That musical note is the symbol for line breaks. If you have MS Word or Notepad++ or similar, open or type some text and then find the menu command for "show nonprinting characters ". You will see those "musical notes" at the end of each line.



来源:https://stackoverflow.com/questions/26014341/in-python-carriage-return-r-returns-a-musical-note

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