Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

An easy way to print messages intended to be overwritten.

Project description

license pypi

temprint

temprint is an acronym for temporary print

This package provides an easy way to output temporary prints intended to be overwritten by other messages. Use it if you want to avoid flooding your terminal with old prints.

Usage

  1. Install it with $ pip install temprint
  2. Now you can use the temprint function, as in:
from time import sleep
from temprint import temprint

msgs = [
    'a short message',
    'a slightly longer message',
    'a tiny msg',
    'a very big message. it is so big that it cannot fit in your ' +
    'terminal width and temprint will behave as a regular print',
    'now a short message again',
    'and a shorter message'
]

for msg in msgs:
    temprint(msg)
    sleep(2)

You should see the messages being printed and then erased iteratively.

If the message is longer than your terminal width, temprint will behave as the regular built-in print function.

The temprint function can receive a series of objects to be printed and a separator:

>>> temprint('first', 'second', 'third', sep='/')
first/second/third

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for temprint, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size temprint-1.0.3.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page