ckdl-0.1a1
توضیحات
KDL parser and writer with a C back-end
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | ckdl-0.1a1 |
| نام | ckdl |
| نسخه کتابخانه | 0.1a1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Thomas Jollans |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/tjol/ckdl |
| آدرس اینترنتی | https://pypi.org/project/ckdl/ |
| مجوز | - |
# ckdl - KDL reading and writing using a C backend
**ckdl** is a C library that implements reading and writing a the
[KDL Document Language](https://kdl.dev/).
This package lets Python programs read and write KDL files, using
*ckdl* as a back-end.
Install with
pip install ckdl
## Examples
### Reading
```pycon
>>> import ckdl
>>> kdl_txt = """
... best-primes 2 3 5 7
... colours importance=(%)1000 { green; blue shade="синий"; blue shade="голубой"; violet }
... """
>>> doc = ckdl.parse(kdl_txt)
>>> doc
<Document; 2 nodes>
>>> doc[0]
<Node best-primes; 4 args>
>>> doc[0].args
[2, 3, 5, 7]
>>> doc[1].properties
{'importance': <Value (%)1000>}
>>> doc[1].properties['importance'].value
1000
>>> doc[1].properties['importance'].type_annotation
'%'
>>> doc[1].children
[<Node green>, <Node blue; 1 property>, <Node blue; 1 property>, <Node violet>]
>>> doc[1].children[1].properties['shade']
'синий'
```
### Writing
```pycon
>>> import ckdl
>>> mydoc = ckdl.Document(ckdl.Node("best-primes", 7, 11, 13), ckdl.Node("worst-primes", ckdl.Value("undoubtedly", 5)))
>>> print(str(mydoc))
best-primes 7 11 13
worst-primes (undoubtedly)5
```
نحوه نصب
نصب پکیج whl ckdl-0.1a1:
pip install ckdl-0.1a1.whl
نصب پکیج tar.gz ckdl-0.1a1:
pip install ckdl-0.1a1.tar.gz