Skip to main content

Prepend each line of a file with line number

Project description

https://badge.fury.io/py/numberify.png https://travis-ci.org/darkowlzz/numberify.svg?branch=master https://coveralls.io/repos/darkowlzz/numberify/badge.png

Add line number to file, create a numbered dictionary object of a list and import numbered dictionary from a file list.

Installation

The script is available on PyPI. To install with pip:

pip install numberify

Usage

To use the script in command line:

numberify <filename>

To use as a python package:

>> from numberify.numberify import Numberify
>> nfy = Numberify()
>> nfy.numberify_data(['foo', 'bar'])
{1: 'foo', 2: 'bar'}
>> nfy.numberify_data(['foo', 'bar'], start=55)
{55: 'foo', 56: 'bar'}

Let a file afile.txt contain:

milk
potatoes
biscuits
sugar

Import the file data numberifies as:

...
>> nfy.numberify_data('afile.txt')
{1: 'milk', 2: 'potatoes', 3: 'biscuits', 4: 'sugar'}
>> nfy.numberify_data('afile.txt', start=15)
{15: 'milk', 16: 'potatoes', 17: 'biscuits', 18: 'sugar'}

To numberify the whole file (apply changes to the file):

...
>> nfy.numberify_file('filename')

Tests

Run test:

python setup.py nosetests

Docs

For detailed docs of the package use python’s help utility.

License

This project is released under a GPL License.

Project details


Download files

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

Source Distribution

numberify-0.0.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

numberify-0.0.1-py2-none-any.whl (6.7 kB view details)

Uploaded Python 2

File details

Details for the file numberify-0.0.1.tar.gz.

File metadata

  • Download URL: numberify-0.0.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for numberify-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a7fcf2f713b370186de632bae1f49415921128642f6f79766f7e6432b00cd180
MD5 d9977b207e2814d6e4d5c0af21a70311
BLAKE2b-256 d6f6d46a939a302ffd114c02256097a4bfa9253d5166d6e0d1fc2a1b897b3586

See more details on using hashes here.

File details

Details for the file numberify-0.0.1-py2-none-any.whl.

File metadata

File hashes

Hashes for numberify-0.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 82ae550dc9d0baf4e8dba3217042b8541aa4b9b95a6bf798868c5d19431f99a9
MD5 dcc8ea54f55afcc09fc4a7f336d41e3e
BLAKE2b-256 9d6548af4da8b685c31e3523ab17640c161270473e70bbd21f90b4b9605c5afb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page