Skip to main content

Prepend each line of a file with line number

Project description

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


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

pip install numberify


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:


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


Run test:

python nosetests


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


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.

Files for numberify, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size numberify-0.0.1-py2-none-any.whl (6.7 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size numberify-0.0.1.tar.gz (3.3 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