In my python program, there are functions within functions, and I've noticed that there are varying amounts of line between where the previous function ends and the first function starts.
Output:
end of previous function
start of first function
However, when the return() statement isn't used, "None" is printed at the end of the function.
Is there any way to get the program to only print out one line after the end of a function, or is this an unavoidable part of python?
(may be related to this, but you can't use this for return I don't think)
Example code:
def function1():
...stuff
def function2():
function1()
....morestuff
while True:
function2()
This will return 2 lines of "None". If return("") is added to the end of each function, just white space is there, and so are the new lines. Is there a way to have a certain amount of lines, or to get rid of them altogether?
ACTUAL CODE EXAMPLE:
def stop():
print("stop")
def login():
print("login")
def list():
print("list")
def runscript():
answer=raw_input("input")
if answer == "stop":
print(stop())
elif answer == "login":
print(login())
elif answer == "list":
print(list())
while True:
print(runscript())
This returns "None" as well as the designated output. If a return("") is added to the end of each function, it still outputs different lines