notebook.community
Edit and run
In [ ]: from collections import deque def tail(path, maxlen=5): result = None with open(path, "r") as f: result = deque(f, maxlen) yield from result for el in tail("test.xml"): print(el)
from collections import deque def tail(path, maxlen=5): result = None with open(path, "r") as f: result = deque(f, maxlen) yield from result for el in tail("test.xml"): print(el)