list(zip(*[iter(lst)]*2))
img = np.float32(img)
img = img[0::2, :] + img[1::2, :]
img = img[:, 0::2] + img[:, 1::2]
img = np.uint8(img / 4)
img = np.uint8(
(np.float32(img[0::2, 0::2]) + img[0::2, 1::2] + img[1::2, 0::2] + img[1::2, 1::2]) / 4
)
kernel = np.ones((2, 2), dtype=np.float32) / 4
img = cv2.filter2D(img, cv2.CV_8U, kernel, anchor=(0, 0))[::2, ::2]
img = np.lib.stride_tricks.as_strided(
img, (*np.array(img.shape[:2]) // 2, 4, 3), (*np.array(img.strides[:2]) * 2, *img.strides[1:])
).mean(axis=-2).astype(np.uint8)
'ot-2020-01-01.txt' < 'ot-2020-01-02.txt' < 'ot-2020-12-17.txt'
from pathlib import Path
date1 = '2020-11-01'
date2 = '2020-12-17'
files = [path.name for path in Path('path/to/dir').glob('ot-*.txt') if f'ot-{date1}.txt' <= path.name <= f'ot-{date2}.txt']
from itertools import starmap
items = [
(161, 0, 'the-north-face', 25, 110),
(164, 1, 'ralf-Lauren', 87, 170),
(165, 2, 'the-north-face', 10, 75)
]
template = 'название: {2}, состояние: {3}, цена: {4}, продать: /sell_{1}'
message = '\n'.join(starmap(template.format, items))
import cv2
cap = cv2.VideoCapture(0)
while True:
ret, img = cap.read()
if ret: # <<<<< этот параметр вам не просто так выдают
cv2.imshow("camera", img)
if cv2.waitKey(10) & 0xFF == 27: # <<<<< 0xFF
break
cap.release()
cv2.destroyAllWindows()
text = 'ROMAlaPARIGIvendita'
from itertools import groupby
from string import ascii_lowercase
# Вариант #1
[''.join(group) for _, group in groupby(text, key=set(ascii_lowercase).issuperset)]
# Вариант #2
[''.join(group) for _, group in groupby(text, key=lambda c: c > 'Z')]
with open('input.csv', 'r') as fi, open('output.csv', 'w') as fo:
print(*fi.readlines()[:-4], file=fo, sep='')
import pandas a pd
pd.read_csv(..., skipfooter=4).to_csv(...)