Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d5358b9 + 790bf0d commit 8bc7ef6Copy full SHA for 8bc7ef6
1 file changed
Doc/library/functions.rst
@@ -617,9 +617,19 @@ are always available. They are listed here in alphabetical order.
617
618
.. function:: hex(x)
619
620
- Convert an integer number to a hexadecimal string. The result is a valid Python
621
- expression. If *x* is not a Python :class:`int` object, it has to define an
622
- :meth:`__index__` method that returns an integer.
+ Convert an integer number to a lowercase hexadecimal string
+ prefixed with "0x", for example:
+
623
+ >>> hex(255)
624
+ '0xff'
625
+ >>> hex(-42)
626
+ '-0x2a'
627
628
+ If x is not a Python :class:`int` object, it has to define an __index__()
629
+ method that returns an integer.
630
631
+ See also :func:`int` for converting a hexadecimal string to an
632
+ integer using a base of 16.
633
634
.. note::
635
0 commit comments