ymd_ ymd_ - 1 month ago 8
Python Question

How to declare a function "to do nothing" in Django

I'm learning Python and Django and i have a question.

I would like to know how to define an function to do nothing and continue with the flow of program execution while i read an archive.

while True:
empty()
with open(r'archive.txt') as myfile:
for line in myfile:
print(line)


¿ FUNCTION to do nothing how can i do it?

def empty():

Answer

If you're using Python 2.x:

def empty():
    pass

With Python 3.x you can also do this:

def empty():
    ... # this is called Ellipsis, simply three dots in a row
Comments