printsection
print("\n", "실습 결과".center(50, "-"), end="\n\n") 를 한 줄로.
출력 결과를 구간별로 나눠 보기 좋게 구분해 줍니다.
pip install printsection
from printsection import section
section("실습 1")
print("...")
section("실습 2")
----------------------실습 1----------------------
...
----------------------실습 2----------------------
위아래 빈 줄과 가운데 정렬이 기본입니다. 한글처럼 화면에서 2칸을 차지하는 글자도 폭을 계산해서 실제 화면 기준으로 가운데에 맞춥니다.
옵션
호출할 때 원하는 값만 바꾸면 됩니다.
section("실습 결과", width=60, fillchar="=")
section("왼쪽 정렬", align="left") # "center" / "left" / "right"
section("빈 줄 조절", top=2, bottom=0)
section("str.center처럼", wide=False) # 글자 수 기준으로 계산
section() # 글자 없이 구분선만
| 옵션 | 기본값 | 설명 |
|---|---|---|
width |
50 |
전체 너비 |
fillchar |
"-" |
채움 문자 (한 글자) |
align |
"center" |
"center", "left", "right" |
top |
1 |
위쪽 빈 줄 수 |
bottom |
1 |
아래쪽 빈 줄 수 |
wide |
True |
한글 등 전각 문자를 2칸으로 계산 |
file |
sys.stdout |
출력 대상 |
기본값 한 번에 바꾸기
from printsection import section, set_defaults, reset_defaults
set_defaults(width=70, fillchar="*")
section("1번 문제")
section("2번 문제")
reset_defaults()
문자열만 받기
from printsection import format_section
s = format_section("실습 결과") # 출력하지 않고 문자열 반환
Metadata
Release files for printsection 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| printsection-0.1.0.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| printsection-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / printsection-0.1.0.tar.gz
| Download URL | printsection-0.1.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0420cbcd3dbbfa8e07a367e3a968f02cd4f8835829b08798bec8dd2628231e9
|
|
BLAKE2b-256 checksum How to use checksums |
9aba32a3aab395cab61d12eca6fcad207d169ef4ddf42a651e8ecf98efffa7eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / printsection-0.1.0-py3-none-any.whl
| Download URL | printsection-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa1b4a3af458214a9d34184976a63f75080ec60f4c9b4b381c15a10da4662a4e
|
|
BLAKE2b-256 checksum How to use checksums |
e4e74f1ebfaa02825c01e58d8c43d340d7c3006275c2678a06eaecf41d111a51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|