def write(self, data):
if not data.rstrip("\n"):
return
f = self._file
cols = get_terminal_size().columns
# Clear the last line.
f.write("\r" + " " * (cols-1))
f.flush()
# Return and write the data.
out = "\r" + data
if not out.endswith("\n"):
out += "\n"
f.write(out)
# Write our string.
f.write(self.line + "\r")
f.flush()
评论列表
文章目录