tprint

hhpy.main.tprint(*args, sep: str = ' ', r_loc: str = 'front', **kwargs)[source]

Wrapper for print() but with a carriage return at the end. This results in the text being overwritten by the next print call. Can be used for progress bars and the like.

Parameters:
  • args – arguments to print
  • sep – separator
  • r_loc – where to put the carriage return, one of [‘front’, ‘end’]. Some interpreters (e.g. PyCharm) don’t like end since they automatically clear the print area after each carriage return. When using front a regular print after a tprint will start at the end of the tprint. When using ‘end’ a regular print will overwrite the tprint output but will not clear the console so if it is . In either case a blank tprint() will clear the console and restore default print behaviour.
  • kwargs – passed to print
Returns:

None

Examples

>>> tprint('Hello World')
'Hello World'
>>> tprint(1)
>>> tprint(2)
2