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
Related Contents:
- How to emulate a do-while loop?
- Else clause on Python while statement
- How do I plot in real-time in a while loop using matplotlib?
- How to check if all elements of a list match a condition?
- How can I make sense of the `else` clause of Python loops?
- How to kill a while loop with a keystroke?
- Assign variable in while loop condition in Python?
- Python loop to run for certain amount of seconds
- for or while loop to do something n times [duplicate]
- Ending an infinite while loop
- How do I plot in real-time in a while loop?
- Get difference between two lists
- How would you make a comma-separated string from a list of strings?
- Does Python optimize tail recursion?
- How to run an .ipynb Jupyter Notebook from terminal?
- Python script to copy text to clipboard [duplicate]
- Open file in a relative location in Python
- How to add an integer to each element in a list?
- What rules does Pandas use to generate a view vs a copy?
- Converting strings to floats in a DataFrame
- Python, add trailing slash to directory string, os independently
- Is “x < y < z" faster than "x < y and y < z"?
- Python PIP Install throws TypeError: unsupported operand type(s) for -=: ‘Retry’ and ‘int’
- Is there an equivalent to CTRL+C in IPython Notebook in Firefox to break cells that are running?
- ValueError: unsupported pickle protocol: 3, python2 pickle can not load the file dumped by python 3 pickle?
- Decorating Hex function to pad zeros
- What is the difference between chain and chain.from_iterable in itertools?
- Class with too many parameters: better design strategy?
- Installing specific BUILD of an anaconda package
- How do I display tooltips in Tkinter?
- Python enumerate() tqdm progress-bar when reading a file?
- How can we force naming of parameters when calling a function?
- Using the AND and NOT Operator in Python [duplicate]
- Assign value to an individual cell in a two dimensional python array [duplicate]
- Django – Rollback save with transaction atomic
- Why use contextlib.suppress as opposed to try/except with pass?
- Does `anaconda` create a separate PYTHONPATH variable for each new environment?
- advanced string formatting vs template strings
- Is there an “ungroup by” operation opposite to .groupby in pandas?
- Could not find a version that satisfies the requirement pytz
- Python: understanding class and instance variables
- In Python with sqlite is it necessary to close a cursor?
- How to replace unicode characters in string with something else python?
- In numpy, what does selection by [:,None] do?
- Row titles for matplotlib subplot
- In Pandas how do I convert a string of date strings to datetime objects and put them in a DataFrame?
- Read a file from server with SSH using Python
- Problems using nose in a virtualenv
- ‘function’ object has no attribute ‘as_view’
- How to iterate through a list of dictionaries