with open(...) as f:
while True:
for element in items:
res = ...
f.write(res)
print (res, file=file)
print (res, end='\n--\n')
print (res, end='')
я думаю на любую версию ОС (из озвученных) можно установить любые версии интерпретаторов и библиотек