I want to iterate through the lines of a file, and print some output for each of them. All lines printed should have a ,\n
at the end, except for the last line.
My first approach was to use look for a hasNext()
method, which doesn't exist. I'm aware that a StopIteration
exception is raised, but I'm not sure how I could use it, in Pythonic way, to achieve what I want.