In the self-defined function, maybe there are many items to be returned. In this case, it will be better to return a dictionary
:
The commonly used:
def my_fun()
# some operations
return item1, item2, item3, item4
With dict
:
def my_fun()
# some operations
return {"item1": value1,
"item2": value2,
"item3": value3,
"item4": value4}
网友评论