https://github.com/mo-han/mo-han-toolbox#subscriptablefileio
from mylib.os_util import SubscriptableFileIO with SubscriptableFileIO('filepath') as f: f[-10:] = b'123abc'