EDIT: Solved this by searching get int bits from float then used the hex() method around the int value. Works perfectly.
import struct
def floatToBits(f):
s = struct.pack('>f', f)
return struct.unpack('>l', s)[0]
print(hex(floatToBits(501.0)))
I think someone already posted something like that below as a comment, so thanks!