Skip to main content

Print two files side-by-side (in columns)

Project description

Print two outputs side-by-side, in Python

side_by_side allows users to print two multi-line outputs side-by-side. This produces an effect similar to running diff -y file1 file2 in a Unix system.

Usage

This library provides a single function, side_by_side.print_side_by_side. To print two_strings side-by-side with default settings:

from side_by_side import print_side_by_side

print_side_by_side(s1, s2)

lorem ipsum output with typical usage

Optional parameters

  • print_line_numbers (bool): If True, prints line-numbers along the left column.
  • col_padding (int): the number of spaces to leave between the two columns (and between the text and line number, if applicable)
  • delimiter (str): a delimiter to separate the columns

Fancy usage

Here's an example of a print format that uses all of the parameters:

from side_by_side import print_side_by_side

print_side_by_side(lorem_ipsum, lorem_ipsum, print_line_numbers=True, col_padding=24, delimiter='|++++|')

lorem ipsum output with typical usage

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

side-by-side-0.0.2.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

side_by_side-0.0.2-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

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