Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jxmorris12/side-by-side
a python library to print two files side-by-side
https://github.com/jxmorris12/side-by-side
Last synced: 3 months ago
JSON representation
a python library to print two files side-by-side
- Host: GitHub
- URL: https://github.com/jxmorris12/side-by-side
- Owner: jxmorris12
- Created: 2020-05-08T22:33:36.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-29T09:03:17.000Z (over 1 year ago)
- Last Synced: 2024-09-17T01:16:29.157Z (3 months ago)
- Language: Python
- Size: 883 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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_sideprint_side_by_side(s1, s2)
```
![lorem ipsum output with typical usage](https://raw.githubusercontent.com/jxmorris12/side-by-side/master/imgs/test.png)## 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_sideprint_side_by_side(lorem_ipsum, lorem_ipsum, print_line_numbers=True, col_padding=24, delimiter='|++++|')
```
![lorem ipsum output with typical usage](https://raw.githubusercontent.com/jxmorris12/side-by-side/master/imgs/test_fancy.png)