Dec-26-2020, 10:57 AM
int()
and float()
can read valid str
and bytes
to convert them. The str-Method strip is not required because int
and float
ignores tailing and leading whitespace.Valid code:
print(int("\n\r\n\t 12 \t\n ")) # from str print(int(b"\n\r\n\t 12 \t\n ")) # from bytes print(float("\n\r\n\t 12.1337 \t\n ")) # from str print(float(b"\n\r\n\t 12.1337 \t\n ")) # from bytes
Output:12
12
12.1337
12.1337
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!