I am currently studying Python and hoping someone could help me. I'm fairly new to coding so would be really helpful if its explained well.
Lets say I have a function called function1
that returns:
return (row, column)
Now I am writing another function called say function2
.
Within this function I need to call say:
exampleItem.exampleName(row, column, name)
How do I use the output of the function1
which is the row and column as the row
and column
arguments in the above line from function2
?
I really hope this makes sense as I got seriously penalized for not writing a question properly before because I didn't realize the best practice here.
In all versions of Python you can do:
row, column = function1()
exampleName(row, column, name)
In more recent versions (3.5+
) you can use unpacking to do things like:
exampleName(*function1(), name)
For further reading see: PEP 448 -- Additional Unpacking Generalizations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With