Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# edrpou.py | |
""" | |
Перевірка контрольних розрядів: | |
ЄДРПОУ | |
ІПН | |
ТРДПАУ |
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import re | |
from os import scandir | |
import sys | |
reg_exp = re.compile('в (м.\s?[А-Я][а-яіїє]+?)\s.+(по\s+[А-Я][а-яіїє]+?\sшосе\,?\s?\d{1,2}[а-яіїє]?)') |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Process map data from ATO map | |
# map URL is: | |
# http://infolight.org.ua/thememap/karta-obstriliv-ta-boyovyh-diy-u-zoni-ato-second-edition | |
""" | |
The MIT License (MIT) | |
Copyright (c) 2016 Renat Nasridinov, <[email protected]> |
#!/bin/bash | |
JAILS=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'` | |
for JAIL in $JAILS | |
do | |
fail2ban-client status $JAIL | |
done |
# Based on https://gist.github.com/fernandoaleman/5083680 | |
# Start the old vagrant | |
$ vagrant init ubuntu_saucy | |
$ vagrant up | |
# You should see a message like: | |
# [default] The guest additions on this VM do not match the install version of | |
# VirtualBox! This may cause things such as forwarded ports, shared | |
# folders, and more to not work properly. If any of those things fail on |
\documentclass[9pt, notumble]{leaflet} | |
\usepackage{amssymb} | |
\usepackage[T1]{fontenc} | |
\usepackage[russian]{babel} | |
\usepackage[useregional]{datetime2} | |
\usepackage[utf8]{inputenc} | |
\usepackage{graphicx} | |
\usepackage{stix} | |
\usepackage{textcomp} | |
\usepackage[unicode=true,colorlinks=true]{hyperref} |
import re | |
import sys | |
import os.path | |
import datetime | |
import urllib.request | |
from os.path import expanduser | |
def get_news_page(): | |
try: |
import csv | |
STI = (83,87,18) | |
xl_db_file = 'f0809m.csv' | |
to_int = lambda x: float(x.replace(' ','').replace(',','.')) | |
def xlfmt_conv(row, len_row): | |
for k in range(3,len_row): | |
row[k] = to_int(row[k]) |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import json | |
from datetime import datetime | |
import locale | |
import sys | |
from sys import platform | |
import argparse | |
import os.path |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!