Q:

Need help understanding example

apologies for the vague nature of my question, however I don't really know what to call the issue I'm having.  So, I found an example online that explains how to use the png module which I have managed to get working and can read in from a png file.  So I can read in the png file in the python interpreter as follows.  First you define in_file to be the png file of interest, then type
>>>r=png.Reader(file=in_file)
>>>r.read()
>>>l=list(_[2])

I don't really understand the last line, can anyone explain what this is doing?  I can see that somehow this associates the png data with the list l but am not really clear on the details.  What I actually want to do is include this in a python script, I tried copying this into my script but it fails at this line, returning
NameError: name '_' is not defined

Again if anyone could explain what is happening and how this should be adapted such that it would work in a script that would be very helpful.  

A:

In the interactive interpreter, _ is the result of the last statement - in this case the return value of the r.read() call. This obviously won't work in scripts as it is only available in the python console. Simply assign the return value to some other variable and use that.

