8000 gh-107017: Change Chapter Strings to Texts in the Introduction chapter. by TommyUnreal · Pull Request #107104 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-107017: Change Chapter Strings to Texts in the Introduction chapter. #107104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Prev Previous commit
Next Next commit
New structure of first paragraph in Text chapter.
  • Loading branch information
TommyUnreal committed Jul 23, 2023
commit 3edff8bb78e280299b227e25d6f740d15a1401c1
19 changes: 13 additions & 6 deletions Doc/tutorial/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,24 @@ and uses the ``j`` or ``J`` suffix to indicate the imaginary part

.. _tut-strings:

Texts
Text
-------

Different kinds of text have the type :class:`str`. This includes
characters "``!``", words "``rabbit``", names "``Paris``", sentences
"``Got your back.``", etc. "``Yay! :)``". They can be enclosed in single
quotes (``'...'``) or double quotes (``"..."``) with the same result [#]_.
``\`` can be used to escape quotes::
Python can manipulate text (represented by type :class:`str`, so called
"strings") as well as numbers. This includes characters "``!``", words
"``rabbit``", names "``Paris``", sentences "``Got your back.``", etc.
"``Yay! :)``". They can be enclosed in single quotes (``'...'``) or double
quotes (``"..."``) with the same result [#]_.

>>> 'spam eggs' # single quotes
'spam eggs'
>>> "Paris rabbit got your back :)! Yay!" # double quotes
'Paris rabbit got your back :)! Yay!'
>>> '1975' # digits and numerals enclosed in quotes are also strings
'1975'

To quote a quote, we need to "escape" it, by preceding it with ``\``::

>>> 'doesn\'t' # use \' to escape the single quote...
"doesn't"
>>> "doesn't" # ...or use double quotes instead
Expand Down
0