Skip to main content

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

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