citerate-0.1
توضیحات
A Python bi-dimensional matrix iterator starting from any point (i, j), going layer by layer around the starting coordinates.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | citerate-0.1 |
| نام | citerate |
| نسخه کتابخانه | 0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Mark Melnic |
| ایمیل نویسنده | me@markmelnic.com |
| آدرس صفحه اصلی | https://github.com/markmelnic/citerate |
| آدرس اینترنتی | https://pypi.org/project/citerate/ |
| مجوز | MIT |
# Circular iterator (Citerate)
Bi-dimensional matrix iterator starting from any point (i, j), iterating layer by layer around the starting coordinates.
## Usage
pip install citerate
As of __14 july 2021__ it contains one method `citerator`
from citerate import citerator
## Examples
Using the example data set:
TEST_SET = [
[10, 11, 12, 13, 14],
[25, 2, 3, 4, 15],
[24, 9, 1, 5, 16],
[23, 8, 7, 6, 17],
[22, 21, 20, 19, 18],
]
Iterate over the set layer by layer starting from coordinates (i=2, j=2) and print each layer as a list of it's corresponding values.
for layer in citerate.citerator(TEST_SET, i=2, j=2, layer=True):
print(layer)
Yields:
[1]
[2, 3, 4, 5, 6, 7, 8, 9]
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
Iterate over the set value by value starting from coordinates (i=2, j=2) and print each value individually.
for value in citerate.citerator(TEST_SET, i=2, j=2):
print(value, end=' ')
Yields:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
# Footnotes
- It is NOT mandatory to iterate starting from the central coordinates or for the matrix to be uniform.
- It HAS to be bi-dimenstional and follow a "list of lists" pattern.
زبان مورد نیاز
| مقدار | نام |
|---|---|
| ==3.* | Python |
نحوه نصب
نصب پکیج whl citerate-0.1:
pip install citerate-0.1.whl
نصب پکیج tar.gz citerate-0.1:
pip install citerate-0.1.tar.gz