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
• 5,870 points
51 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 9,300 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
59 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,100 points
57 views
+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
30 views
0 votes
1 answer

Create an empty list in python with certain size

Try this instead: lst = [None] * 10 The ...READ MORE

answered Aug 2, 2018 in Python by bug_seeker
• 14,960 points
64 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 920 points
18 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
• 9,300 points
95 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
• 9,300 points
26 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.