Skip to content

Instantly share code, notes, and snippets.

@phi-line
Created July 24, 2018 00:01
Show Gist options
  • Save phi-line/865a62b53c28aba2ada490b68d8932ef to your computer and use it in GitHub Desktop.
Save phi-line/865a62b53c28aba2ada490b68d8932ef to your computer and use it in GitHub Desktop.

Revisions

  1. phi-line created this gist Jul 24, 2018.
    11 changes: 11 additions & 0 deletions print carriage return
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    def print_c(message):
    """
    Clears last carriage returned line and writes a new one
    :param message: (str)
    :return: None
    """
    sys.stdout.write('\x1b[2K')
    sys.stdout.write(message)
    sys.stdout.flush()

    print_c(f"Hello!\r")