prettier_prints
2.0.2
مكتبة خفيفة الوزن لمخرجات طرفية أجمل مماثلة للطباشير لجافا سكريبت. المساعدة في جعل مخرجات Python أسهل في القراءة وتصميمها على رغباتك.
pip install prettier - printsأمثلة: Out ()
from prettier_prints . prettier_prints import PrettierPrints
pp = PrettierPrints ()
pp . style = 'red;underline' # <-- Can optionally predefine styling and can be overwritten
# Old style (v1)
print ( pp . out ( msg = "Lets test the output" ))
print ( pp . out ( msg = "Lets override the styling here" , style = "blue;bold" ))
print ( pp . out ( json_out = { 'msg' : 'For those who prefer a JSON object param, this works too' }))
print ( pp . out ( json_out = { 'msg' : 'Can also overwrite this way' , 'style' : 'yellow;highlight' }))
print ( f'Works great for output messages as well -> { pp . out ( msg = "See :)" , style = "magenta" ) } ' )
# New v2 style
from prettier_prints . prettier_printsv2 import Output
pp = Output ()
print ( f" n { pp . msg ( 'Hello' ). red (). bold (). underline () } " )
print ( f" { pp . msg ( 'Hello' ). green (). bold (). out () } " )
json ()
from prettier_prints . prettier_prints import PrettierPrints
pp = PrettierPrints ()
json_obj = { 'test' : 'cool' , 'test_two' : 'cool_two' , 'dict_check' : { 'test' : 'hello' },
'list_check' : [
'test' ,
'test two' ,
{
'test' : 'hello' ,
'test_two' : 'bloop'
},
{
'test' : 'hello' ,
'test_two' : 'bloop'
}
]}
print ( prettier_prints . json ( json_obj = json_obj , style = 'list=blue;underline&dict=red;bold&string=green;' ))
- out()
- msg: str Output / display message[required]
- style: str Styling to apply to the message[optional]
- json_out: dict JSON object containing the message and styling[optional]
- json()
- style: str Styling to apply to the message[optional]
- json_obj: dict JSON object containing the message and styling[required]
- out()
- style: 'red;underline'
- json_out: {'msg': 'Lets test the output', 'style': 'blue;bold'}
- json()
- style: 'list=red;underline&dict=blue;bold&str=yellow;highlight' # <- Break up the styling by type (list, dict, str)
| المعدلات | ألوان / ألوان الخلفية |
|---|---|
| عريض | أحمر |
| تسطير | أخضر |
| تسليط الضوء | أصفر |
| أزرق | |
| أرجواني | |
| سماوي | |
| أبيض | |
| أحمر مشرق | |
| أخضر مشرق | |
| أصفر مشرق | |
| أزرق مشرق | |
| أرجواني مشرق | |
| سماوي مشرق | |
| أبيض مشرق |