On 08May2020 09:36, Sir Real <nom...@adres.net> wrote:
On Fri, 8 May 2020 16:25:52 +0200, ast <ast@invalid> wrote:
Suppose we want that:

print("abcdef"); print("ghi")

produces:

ghidef

The 2nd print overwrites the first one.
Is it feasible ?

On a terminal, yes. This is a display issue.

It should since the progress bar tdqh seems to do that

try:
from tkdm import tkdm
for i in tqdm(range(100_000_000)):
    pass
It produces a progress bar like this:
100%|???????????????????????????????????????????????????????????????|
100000000/100000000 [00:56<00:00, 1781611.52it/s]


print('abcdef', end='\r'); print('ghi', end='')

Aye, though that is the (hated by me) rewrite-the-whole-line brute force approach.

I've got a module "cs.upd" on PyPI which does this with minimal overwrites if you want something eaier on the eyes. Doubtless there are others.

Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to