while file.readline().startswith("#"):
pass
This uses the pass statement :
The pass statement does nothing. It can be used when a statement is required syntactically but the program requires no action.
http://www.network-theory.co.uk/docs/pytut/passStatements.html