Every line of 'hexadecimal to decimal python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
26 def _hex2dec(s): 27 return str(int(s,16))
33 def test_dec_to_hex(self): 34 self.assertEqual(conversion.decimal_to_hex(30), '1E')
5 def toHex(self, num): 6 """ 7 :type num: int 8 :rtype: str 9 """ 10 if not num: 11 return "0" 12 13 result = [] 14 while num and len(result) != 8: 15 h = num & 15 16 if h < 10: 17 result.append(str(chr(ord('0') + h))) 18 else: 19 result.append(str(chr(ord('a') + h-10))) 20 num >>= 4 21 result.reverse() 22 23 return "".join(result)
96 def dec_to_hex(dec): 97 return str(format(dec, "x"))
30 def hex2dec(hex): 31 """ Convert and hex value in a decimal number 32 """ 33 return int(hex, 16)
182 def decodeaDecimal(bv, validate=False): 183 return Decimal(binary.signedIntFromBV(bv[78:94]))/Decimal('10')
22 def _double_to_hex(val): 23 return struct.unpack('Q', struct.pack('d', val))[0]
372 def test__DECIMAL_to_python(self): 373 """Convert a MySQL DECIMAL to a Python decimal.Decimal type""" 374 data = b'3.14' 375 exp = Decimal('3.14') 376 res = self.cnv._DECIMAL_to_python(data) 377 378 self.assertEqual(exp, res) 379 380 self.assertEqual(self.cnv._DECIMAL_to_python, 381 self.cnv._NEWDECIMAL_to_python)
894 def hex2char(hexadec): 895 """Answers the unicode char that matcher the hex value. Answer None if 896 conversion fails. 897 898 >>> hex(ord('A')) 899 '0x41' 900 >>> hex2dec('41') 901 65 902 >>> hex2char('41') 903 'A' 904 >>> hex2char('FFZ') is None 905 True 906 """ 907 v = hex2dec(hexadec) 908 if v is not None: 909 return chr(v) 910 return None