'terminal output from python to excel

I have a terminal output in python as

2020
2021

This should appear in excel using for loop in python

enter image description here

How to do this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source