Python newbie here. I was trying to troubleshoot an issue with writing a csv file in a larger program and decided to go back to basics to try to find the problem.
I tried this out in the python interpreter. In the first bit of code, I see content in the csv only after I exit python (when the file is closed). Definitely, this was something to with closing the file.