These are allowed since Python 3.6, see PEP 515 - Underscores in Numeric Literals. As stated in the PEP
The underscores have no semantic meaning, and literals are parsed as if the underscores were absent.
So they are just available for readability for large numbers, binary literals, hex addresses, etc. Some examples from the PEP:
>>> assert 10_000_000 == 10000000
>>> assert 0xCAFE_F00D == 0xCAFEF00D
>>> assert 0b_0011_1111_0100_1110 == 0b0011111101001110