write output in files
This commit is contained in:
@@ -50,7 +50,10 @@ def render_template(name, template):
|
|||||||
'fixed_row': 3,
|
'fixed_row': 3,
|
||||||
'columns': [c for c in generate_columns()]
|
'columns': [c for c in generate_columns()]
|
||||||
}
|
}
|
||||||
print(template.render(vals))
|
filename = os.path.join(os.path.dirname(os.path.dirname(__file__)),'output')
|
||||||
|
filename = os.path.join(filename, f'{name}.txt')
|
||||||
|
with open(filename, 'w', encoding='utf8', newline='') as f:
|
||||||
|
f.write(template.render(vals))
|
||||||
|
|
||||||
|
|
||||||
def init_templates():
|
def init_templates():
|
||||||
@@ -67,7 +70,6 @@ def init_templates():
|
|||||||
def main():
|
def main():
|
||||||
templates = init_templates()
|
templates = init_templates()
|
||||||
for template in templates.items():
|
for template in templates.items():
|
||||||
print(template[0], template[1])
|
|
||||||
render_template(template[0], template[1])
|
render_template(template[0], template[1])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
{% extends 'base.jinja2' %}
|
{% extends 'base.jinja2' %}{% block conditions %}
|
||||||
{% block conditions %}
|
{% for column in columns %}IF(AND({{column}}{{row_num}}={{column}}${{fixed_row}};{{column}}${{fixed_row}}="Ч");1;0);
|
||||||
{% for column in columns %}
|
{% endfor %}
|
||||||
IF(AND({{column}}{{row_num}}={{column}}${{fixed_row}};{{column}}${{fixed_row}}="Ч");1;0);
|
|
||||||
{% endfor %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
{% extends 'base.jinja2' %}
|
{% extends 'base.jinja2' %}{% block conditions %}
|
||||||
{% block conditions %}
|
{% for column in columns %}IF({{column}}{{row_num}}={{column}}${{fixed_row}};1;0);
|
||||||
{% for column in columns %}
|
{% endfor %}
|
||||||
IF({{column}}{{row_num}}={{column}}${{fixed_row}};1;0);
|
|
||||||
{% endfor %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
{% extends 'base.jinja2' %}
|
{% extends 'base.jinja2' %}{% block conditions %}
|
||||||
{% block conditions %}
|
{% for column in columns %}IF(AND({{column}}{{row_num}}={{column}}${{fixed_row}};{{column}}${{fixed_row}}="К");1;0);
|
||||||
{% for column in columns %}
|
{% endfor %}
|
||||||
IF(AND({{column}}{{row_num}}={{column}}${{fixed_row}};{{column}}${{fixed_row}}="К");1;0);
|
|
||||||
{% endfor %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user