空循环的Python语法

jsj*_*jsj 30 python while-loop

我写了这个:

    while file.readline().startswith("#"):
        continue
Run Code Online (Sandbox Code Playgroud)

但我怀疑这continue是不必要的?我正在努力实现的正确语法是什么?

ogz*_*gzd 49

while file.readline().startswith("#"):
    pass
Run Code Online (Sandbox Code Playgroud)

这使用pass语句:

pass语句什么都不做.当语法需要语句但程序不需要操作时,可以使用它.

http://www.network-theory.co.uk/docs/pytut/passStatements.html