Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8bc7ef63
Commit
8bc7ef63
authored
Mar 16, 2014
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Plain Diff
Close #16665: improve documentation for hex(). Patch by Jessica McKellar.
parents
d5358b94
790bf0db
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
Doc/library/functions.rst
Doc/library/functions.rst
+13
-3
No files found.
Doc/library/functions.rst
View file @
8bc7ef63
...
...
@@ -617,9 +617,19 @@ are always available. They are listed here in alphabetical order.
.. function:: hex(x)
Convert an integer number to a hexadecimal string. The result is a valid Python
expression. If *x* is not a Python :class:`int` object, it has to define an
:meth:`__index__` method that returns an integer.
Convert an integer number to a lowercase hexadecimal string
prefixed with "0x", for example:
>>> hex(255)
'0xff'
>>> hex(-42)
'-0x2a'
If x is not a Python :class:`int` object, it has to define an __index__()
method that returns an integer.
See also :func:`int` for converting a hexadecimal string to an
integer using a base of 16.
.. note::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment