Python > multiline stringsの内容表示の違い > print / automatic echoing done by the interactive interpreter
1863 ワード
動作環境
Xeon E5-2620 v4 (8コア) x 2
32GB RAM
CentOS 6.8 (64bit)
openmpi-1.8.x86_64 とその-devel
mpich.x86_64 3.1-5.el6とその-devel
gcc version 4.4.7 (とgfortran)
NCAR Command Language Version 6.3.0
WRF v3.7.1を使用。
Python 2.6.6
@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic
(No. 802 / 12833)
"""
や'''
を使ったmultiline stringsの場合の内容表示について、以下の違いが記載されている。
- print()
- automatic echoing done by the interactive interpreter:
適当な文章で試してみた。
>>> poem='''She sells seashells at the seashore.
... Mirror mirror on the wall who is the fairest of them all?
... A lie is a lie is a lie, no matter how white, how small,
... how incorporating of a smidgen of truth there be in it.'''
>>> print(poem)
She sells seashells at the seashore.
Mirror mirror on the wall who is the fairest of them all?
A lie is a lie is a lie, no matter how white, how small,
how incorporating of a smidgen of truth there be in it.
>>> poem
'She sells seashells at the seashore.\n Mirror mirror on the wall who is the fairest of them all?\n A lie is a lie is a lie, no matter how white, how small,\n how incorporating of a smidgen of truth there be in it.'
automatic echoing時は内容の前後に"'(シングルクォーテーション)"が付き、改行記号も\n
として表示される。
Author And Source
この問題について(Python > multiline stringsの内容表示の違い > print / automatic echoing done by the interactive interpreter), 我々は、より多くの情報をここで見つけました https://qiita.com/7of9/items/23633a4930f0a031bb9c著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .