I have a function like this one:
def hexify_string(aString):
#code for string2hexa conversion
…and I want to have a function who accepts one or more (quantity undefined) parameters, and to return the hexadecimal representation of the sum of the parameters.
def hexify(a,b...n):
#map hexify_string to all the parameters, and return the sum of them
Is there a way of doing this using *args / **kwars?
*argstakes all non-keyword parameters and turns them into a list. You can maphexify_stringto each element of the list, and then return the sum of all the elements in the list.This is assuming your
hexify_stringfunction returns a hex value, not a string.