Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added decimal alignment option #90

Merged
merged 6 commits into from
Dec 28, 2022
Merged

Conversation

DenverCoder1
Copy link
Owner

@DenverCoder1 DenverCoder1 commented Dec 28, 2022

from table2ascii import table2ascii as t2a, PresetStyle, TableStyle, Alignment

output = t2a(
    header=["1.1.1", "G", "Long Header", "H", "R"],
    body=[[100.00001, 2, 3.14, 33, "AB"], [10.0001, 22.0, 2.718, 3, "CD"]],
    footer=[10000.01, "123", 10.0, 1, "E"],
    alignments=[Alignment.DECIMAL] * 5,
    first_col_heading=True,
    style=PresetStyle.double_thin_box,
)

print(output)
╔═════════════╦═══════╤═════════════╤════╤════╗
║    1.1.1    ║   G   │ Long Header │ H  │ R  ║
╠═════════════╬═══════╪═════════════╪════╪════╣
║   100.00001 ║   2   │    3.14     │ 33 │ AB ║
╟─────────────╫───────┼─────────────┼────┼────╢
║    10.0001  ║  22.0 │    2.718    │  3 │ CD ║
╠═════════════╬═══════╪═════════════╪════╪════╣
║ 10000.01    ║ 123   │   10.0      │  1 │ E  ║
╚═════════════╩═══════╧═════════════╧════╧════╝

@DenverCoder1 DenverCoder1 added the enhancement New feature or request label Dec 28, 2022
@DenverCoder1 DenverCoder1 merged commit 12bab03 into main Dec 28, 2022
@DenverCoder1 DenverCoder1 deleted the feat/decimal-alignment branch December 28, 2022 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant