Skip to main content

Formats dates, numbers, etc. in a pretty, human readable format.

Project description

Sample code:

from datetime import datetime, timedelta
now =
hrago = now - timedelta(hours=1)
yesterday = now - timedelta(days=1)
tomorrow = now + timedelta(days=1)
dayafter = now + timedelta(days=2)

import pretty
print                      # 'now'
print                    # 'an hour ago'
print, short=True)        # '1h ago'
print, asdays=True)       # 'today'
print, short=True)    # 'yest'
print                 # 'tomorrow'

Project details

Release history Release notifications | RSS feed

This version


Download files

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

Files for py-pretty, version 1
Filename, size File type Python version Upload date Hashes
Filename, size (1.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page