Nov-25-2022, 06:19 PM
Hello,
I was going through a tutorial on Unicode and character encodings in Python and I came across a function that the author presents as a way to convert Unicode strings that look like "U+10346" into actual Unicode characters. The function is as follows:
I was going through a tutorial on Unicode and character encodings in Python and I came across a function that the author presents as a way to convert Unicode strings that look like "U+10346" into actual Unicode characters. The function is as follows:
def make_uchr(code: str): return chr(int(code.lstrip("U+").zfill(8), 16))I'm having trouble understanding why there are two numbers as parameters after ".zfill." Everything I read online says that .zfill only takes one parameter (the specified length of the zero-filled string that is sought) and I don't believe the "16" is an argument that is used by the lstrip method. If anyone could help clarify this for me I'd greatly appreciate it. Thank you.