Empty while loop in Python

0 votes
For the following syntax in a code :

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

Do i need to use "continue"? Or is there any other syntax for the same?
Dec 5, 2018 in Python by ana1504.k
• 7,510 points
95 views

1 answer to this question.

0 votes
while file.readline().startswith("#"):
    pass

The pass statement does nothing. It can be used when a statement is required syntactically but the program requires no action.
answered Dec 5, 2018 by SDeb
• 12,440 points

Related Questions In Python

0 votes
1 answer

Do-while loop in Python

Python does not have a do-while construct.  If ...READ MORE

answered May 11, 2018 in Python by Hamartia's Mask
• 1,580 points
87 views
0 votes
1 answer

Why there is no do while loop in python

There is no do...while loop because there ...READ MORE

answered Aug 6, 2018 in Python by Priyaj
• 56,160 points
87 views
0 votes
0 answers
+2 votes
2 answers

Error while printing hello world in python.

You must be trying this command in ...READ MORE

answered Mar 31, 2018 in Python by GandalfDwhite
• 1,320 points
64 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 134 views
0 votes
1 answer

Indentation of Python in Notepad++

To indent the block, select the entire ...READ MORE

answered Sep 18, 2018 in Python by SDeb
• 12,440 points
166 views
0 votes
1 answer

Print C format in Python

For printf- style formatting and special case ...READ MORE

answered Sep 18, 2018 in Python by SDeb
• 12,440 points
30 views