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 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

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