This is just about my first day using Python, and I'm trying to remove any accents in a set of arguments that I have. I know how to convert a given string to unicode:
myfoo = u'àà'
But how do I convert the arguments of a function into unicode? My attempt was to create a function that began as follows:
def newfunction(args):
myunicode = u'args['arg1']'
convertedarg1 = unicodedata.normalize('NFD', my_unicode).encode('ascii', 'ignore')
But of course, this "converts" the string "args['arg1']"
instead of the actual value given to arg1
. I would like to fix the first step such that if arg1=café, convertedarg1 = cafe.
I hope that makes some sense.