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.
1 parent 0392271 commit 790bf0dCopy full SHA for 790bf0d
1 file changed
Doc/library/functions.rst
@@ -608,9 +608,19 @@ are always available. They are listed here in alphabetical order.
608
609
.. function:: hex(x)
610
611
- Convert an integer number to a hexadecimal string. The result is a valid Python
612
- expression. If *x* is not a Python :class:`int` object, it has to define an
613
- :meth:`__index__` method that returns an integer.
+ Convert an integer number to a lowercase hexadecimal string
+ prefixed with "0x", for example:
+
614
+ >>> hex(255)
615
+ '0xff'
616
+ >>> hex(-42)
617
+ '-0x2a'
618
619
+ If x is not a Python :class:`int` object, it has to define an __index__()
620
+ method that returns an integer.
621
622
+ See also :func:`int` for converting a hexadecimal string to an
623
+ integer using a base of 16.
624
625
.. note::
626
0 commit comments