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
007a382a
Commit
007a382a
authored
May 18, 2006
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #1490688: properly document %e, %f, %g format subtleties.
parent
7b90e168
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
11 deletions
+30
-11
Doc/lib/libstdtypes.tex
Doc/lib/libstdtypes.tex
+30
-11
No files found.
Doc/lib/libstdtypes.tex
View file @
007a382a
...
@@ -970,20 +970,22 @@ The conversion types are:
...
@@ -970,20 +970,22 @@ The conversion types are:
\lineiii
{
u
}{
Unsigned decimal.
}{}
\lineiii
{
u
}{
Unsigned decimal.
}{}
\lineiii
{
x
}{
Unsigned hexadecimal (lowercase).
}{
(2)
}
\lineiii
{
x
}{
Unsigned hexadecimal (lowercase).
}{
(2)
}
\lineiii
{
X
}{
Unsigned hexadecimal (uppercase).
}{
(2)
}
\lineiii
{
X
}{
Unsigned hexadecimal (uppercase).
}{
(2)
}
\lineiii
{
e
}{
Floating point exponential format (lowercase).
}{}
\lineiii
{
e
}{
Floating point exponential format (lowercase).
}{
(3)
}
\lineiii
{
E
}{
Floating point exponential format (uppercase).
}{}
\lineiii
{
E
}{
Floating point exponential format (uppercase).
}{
(3)
}
\lineiii
{
f
}{
Floating point decimal format.
}{}
\lineiii
{
f
}{
Floating point decimal format.
}{
(3)
}
\lineiii
{
F
}{
Floating point decimal format.
}{}
\lineiii
{
F
}{
Floating point decimal format.
}{
(3)
}
\lineiii
{
g
}{
Same as
\character
{
e
}
if exponent is greater than -4 or
\lineiii
{
g
}{
Floating point format. Uses exponential format
less than precision,
\character
{
f
}
otherwise.
}{}
if exponent is greater than -4 or less than precision,
\lineiii
{
G
}{
Same as
\character
{
E
}
if exponent is greater than -4 or
decimal format otherwise.
}{
(4)
}
less than precision,
\character
{
F
}
otherwise.
}{}
\lineiii
{
G
}{
Floating point format. Uses exponential format
if exponent is greater than -4 or less than precision,
decimal format otherwise.
}{
(4)
}
\lineiii
{
c
}{
Single character (accepts integer or single character
\lineiii
{
c
}{
Single character (accepts integer or single character
string).
}{}
string).
}{}
\lineiii
{
r
}{
String (converts any python object using
\lineiii
{
r
}{
String (converts any python object using
\function
{
repr()
}
).
}{
(
3
)
}
\function
{
repr()
}
).
}{
(
5
)
}
\lineiii
{
s
}{
String (converts any python object using
\lineiii
{
s
}{
String (converts any python object using
\function
{
str()
}
).
}{
(
4
)
}
\function
{
str()
}
).
}{
(
6
)
}
\lineiii
{
\%
}{
No argument is converted, results in a
\character
{
\%
}
\lineiii
{
\%
}{
No argument is converted, results in a
\character
{
\%
}
character in the result.
}{}
character in the result.
}{}
\end{tableiii}
\end{tableiii}
...
@@ -1003,10 +1005,27 @@ Notes:
...
@@ -1003,10 +1005,27 @@ Notes:
formatting of the number if the leading character of the result is
formatting of the number if the leading character of the result is
not already a zero.
not already a zero.
\item
[(3)]
\item
[(3)]
The
\code
{
\%
r
}
conversion was added in Python 2.0.
The alternate form causes the result to always contain a decimal
point, even if no digits follow it.
The precision determines the number of digits after the decimal
point and defaults to 6.
\item
[(4)]
\item
[(4)]
The alternate form causes the result to always contain a decimal
point, and trailing zeroes are not removed as they would
otherwise be.
The precision determines the number of significant digits before
and after the decimal point and defaults to 6.
\item
[(5)]
The
\code
{
\%
r
}
conversion was added in Python 2.0.
The precision determines the maximal number of characters used.
\item
[(6)]
If the object or format provided is a
\class
{
unicode
}
string,
If the object or format provided is a
\class
{
unicode
}
string,
the resulting string will also be
\class
{
unicode
}
.
the resulting string will also be
\class
{
unicode
}
.
The precision determines the maximal number of characters used.
\end{description}
\end{description}
% XXX Examples?
% XXX Examples?
...
...
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