This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import defaultdict, Counter | |
| from typing import Mapping, List | |
| """ Most commom element with Counter."" | |
| stuff: List = ['book', 'book', 'phone', 'book', 'phone'] | |
| cnt = Counter(stuff) | |
| # first most common | |
| # first element of the list and a tuple | |
| cnt.most_common(1)[0][0] | |
| # 'book' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import psycopg2 | |
| import psycopg2.extras | |
| from configparser import ConfigParser | |
| import logging | |
| logger = logging.getLogger() | |
| logging.basicConfig(format='%(asctime)s %(message)s') | |
| logger.setLevel(logging.DEBUG) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # can also include requirements | |
| # create _init_.py in the package folder | |
| # to install: `pip install -e .` | |
| # or with the github/lab url `pip install git+ssh://git@gitlab.com/...` | |
| import os | |
| import setuptools | |
| here = os.path.abspath(os.path.dirname(__file__)) |
OlderNewer