Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
a658427b
Commit
a658427b
authored
Dec 18, 2012
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Temporary disabled String Formatting part. Get rid of "conversion".
parent
c1ca4a45
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
85 deletions
+84
-85
doc/conf.py
doc/conf.py
+2
-2
doc/index.rst
doc/index.rst
+1
-1
doc/string.rst
doc/string.rst
+81
-82
No files found.
doc/conf.py
View file @
a658427b
...
@@ -25,7 +25,7 @@ import sys, os
...
@@ -25,7 +25,7 @@ import sys, os
# Add any Sphinx extension module names here, as strings. They can be extensions
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions
=
[
'sphinx.ext.
mathjax
'
]
extensions
=
[
'sphinx.ext.
ifconfig
'
]
# Add any paths that contain templates here, relative to this directory.
# Add any paths that contain templates here, relative to this directory.
templates_path
=
[
'-templates'
]
templates_path
=
[
'-templates'
]
...
@@ -91,7 +91,7 @@ pygments_style = 'sphinx'
...
@@ -91,7 +91,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# a list of builtin themes.
html_theme
=
'
default
'
html_theme
=
'
sphinxdoc
'
# Theme options are theme-specific and customize the look and feel of a theme
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# further. For a list of options available for each theme, see the
...
...
doc/index.rst
View file @
a658427b
...
@@ -11,7 +11,7 @@ Contents:
...
@@ -11,7 +11,7 @@ Contents:
.. toctree::
.. toctree::
:maxdepth: 2
:maxdepth: 2
string
Indices and tables
Indices and tables
==================
==================
...
...
doc/string.rst
View file @
a658427b
..
_string-formatting:
..
ifconfig:: False
String Formatting
.. _string-formatting:
-----------------
The built-in string class provides the ability to do complex variable
String Formatting
substitutions and value formatting via the :func:`format` method described in
-----------------
:pep:`3101`. The :class:`Formatter` class in the :mod:`string` module allows
you to create and customize your own string formatting behaviors using the same
implementation as the built-in :meth:`format` method.
The built-in string class provides the ability to do complex variable
substitutions and value formatting via the :func:`format` method described in
:pep:`3101`. The :class:`Formatter` class in the :mod:`string` module allows
you to create and customize your own string formatting behaviors using the same
implementation as the built-in :meth:`format` method.
.. class:: Formatter
.. class:: Formatter
The :class:`Formatter` class has the following public methods:
The :class:`Formatter` class has the following public methods:
...
@@ -107,9 +109,8 @@ implementation as the built-in :meth:`format` method.
...
@@ -107,9 +109,8 @@ implementation as the built-in :meth:`format` method.
Format String Syntax
Format String Syntax
--------------------
--------------------
The :meth:`str.format` method and the :class:`Formatter` class share the same
The :meth:`Format` function and the :class:`Formatter` class share the same
syntax for format strings (although in the case of :class:`Formatter`,
syntax for format strings.
subclasses can define their own format string syntax).
Format strings contain "replacement fields" surrounded by curly braces ``{}``.
Format strings contain "replacement fields" surrounded by curly braces ``{}``.
Anything that is not contained in braces is considered literal text, which is
Anything that is not contained in braces is considered literal text, which is
...
@@ -119,20 +120,18 @@ literal text, it can be escaped by doubling: ``{{`` and ``}}``.
...
@@ -119,20 +120,18 @@ literal text, it can be escaped by doubling: ``{{`` and ``}}``.
The grammar for a replacement field is as follows:
The grammar for a replacement field is as follows:
.. productionlist:: sf
.. productionlist:: sf
replacement_field: "{" [`field_name`] ["
!" `conversion`] ["
:" `format_spec`] "}"
replacement_field: "{" [`field_name`] [":" `format_spec`] "}"
field_name: arg_name ("." `attribute_name` | "[" `element_index` "]")*
field_name: arg_name ("." `attribute_name` | "[" `element_index` "]")*
arg_name: [`identifier` | `integer`]
arg_name: [`identifier` | `integer`]
attribute_name: `identifier`
attribute_name: `identifier`
element_index: `integer` | `index_string`
element_index: `integer` | `index_string`
index_string: <any source character except "]"> +
index_string: <any source character except "]"> +
conversion: "r" | "s" | "a"
format_spec: <described in the next section>
format_spec: <described in the next section>
In less formal terms, the replacement field can start with a *field_name* that specifies
In less formal terms, the replacement field can start with a *field_name* that specifies
the object whose value is to be formatted and inserted
the object whose value is to be formatted and inserted
into the output instead of the replacement field.
into the output instead of the replacement field.
The *field_name* is optionally followed by a *conversion* field, which is
The *field_name* is optionally followed by a *format_spec*, which is preceded
preceded by an exclamation point ``'!'``, and a *format_spec*, which is preceded
by a colon ``':'``. These specify a non-default format for the replacement value.
by a colon ``':'``. These specify a non-default format for the replacement value.
See also the :ref:`formatspec` section.
See also the :ref:`formatspec` section.
...
...
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