'Python syntax for an empty while loop

I have written this:

    while file.readline().startswith("#"):
        continue

But I suspect the continue is unnecessary? What is the correct syntax for what i'm trying to achieve?



Solution 1:[1]

Accepted answer link to pass statement tutorial is no longer working see official docs here:

https://docs.python.org/3/tutorial/controlflow.html#pass-statements

pass is a null operation — when it is executed, nothing happens. It is useful as a placeholder when a statement is required syntactically, but no code needs to be executed

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 social