Skip to content

Commit 5a1c421

Browse files
committed
Update p03_format_numbers_for_output.rst
add missing spaces
1 parent 328a5a1 commit 5a1c421

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

source/c03/p03_format_numbers_for_output.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
2525
>>> # Right justified in 10 chars, one-digit accuracy
2626
>>> format(x, '>10.1f')
27-
' 1234.6'
27+
' 1234.6'
2828
2929
>>> # Left justified
3030
>>> format(x, '<10.1f')
31-
'1234.6 '
31+
'1234.6 '
3232
3333
>>> # Centered
3434
>>> format(x, '^10.1f')
35-
' 1234.6 '
35+
' 1234.6 '
3636
3737
>>> # Inclusion of thousands separator
3838
>>> format(x, ',')
@@ -98,9 +98,9 @@
9898
>>> '%0.2f' % x
9999
'1234.57'
100100
>>> '%10.1f' % x
101-
' 1234.6'
101+
' 1234.6'
102102
>>> '%-10.1f' % x
103-
'1234.6 '
103+
'1234.6 '
104104
>>>
105105
106106
这种格式化方法也是可行的,不过比更加先进的 ``format()`` 要差一点。

0 commit comments

Comments
 (0)