What does cur variable do in Python

I am doing a Coursera course, working with Python and SQL databases. The code further below is largely example code from the course. I have to alter it for an assignment.

The part which I do not completely understand is this part:

What I do understand is that the if clause looks if the email address is already there and adds if it is not, and increases the count if it is. However I do not fully understand what it is "SELECTING" and what is is fetching (fetchone). I have some questions about this.

  1. Can someone explain to me intuitively how this part works?

  2. I am normally used to using print statements to see what is happening. Is there a similar approach here that I can use to see what I am doing?

  3. As a last small question in the code ''' is used for the SQL but also a single ' , for example in the first line above (They also give different colours in my Notepad++). Is there any difference between these to?

Note - I am using Python 3.6

asked Jun 18 '17 at 16:22

TomTom

1,27144 silver badges1616 bronze badges