Extracts marks of all students in class from website
Style

Your code looks good but you might like to know that there is a Style Guide for Python Code called PEP 8. If you are interested, you'll find tools to check your code automatically (pep8) and to fix it (autopep8).

In your case, I can see straight-away that you are sometimes missing spaces around your '+' operator.

String format

You'll find various more pythonic ways to format your number with leadings 0s.

Also, in case you want to keep your current logic, comparison can be written pretty succintly in Python so that you can simply write : if 1 &lt;= roll &lt; 10. (Please note that in Python 2.x, range returns a list so checking if x in range(whatever) is not efficient in time (it has to check all elements if the elements you are looking for is not in the list) nor in memory (a list is built for no reason)).

Using context managers

Opening files and remembering to close them is a bit tedious. Good thing is that Python has a clean solution to this : the with keyword. In a nutshell, you use with when you open your file, you add a level of indentation and the magic to close your file will happen automaticaly.