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

Reverse Printf

Project description

pypi-version License

Reverse Printf.

I dont understand

Look this code (python):

>>> print("%2d%2d" % (19, 81))
1981

Oh well, but what’s happen if I need revert the number 1981 to original 19 and 81?:

$ echo "1981" | reverpf "%2d%2d"
|19|81

Of course, only works in fixed print.

System requirements

  • Python3

Compatibility

I do not know if the printf of C is a standard, but it seems that the python works the same.

Installation

$ pip install reverpf

Help

Usage

usage: reverpf [-h] -f FORMAT [-i FILE] [-s SEPARATOR] [-v]

optional arguments:
  -h, --help            show this help message and exit
  -f FORMAT, --format FORMAT
                        Format from printf
  -i FILE, --input-file FILE
                        File input
  -s SEPARATOR, --separator SEPARATOR
                        Separator string
  -v, --version         show program's version number and exit

Examples

# From stdin
$ echo "1981" | reverpf -f "%2d%2d"
;19;81;

# From file
$ reverpf -f "%2d%2d" -i file.txt -s "|"
|19|81|

License

MIT

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 reverpf, version 0.6.1
Filename, size File type Python version Upload date Hashes
Filename, size reverpf-0.6.1-py3-none-any.whl (6.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size reverpf-0.6.1.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page