Pythonで文章を改行する、複数行をまたいでひとつの命令を書く方法についてです。
文字列を改行

まず前提として、通常の書き方の場合、Pythonでは複数行に分けたコードは別の命令とみなされます。

上の例なら一行にまとめれば済む話ですが、たとえば文章が極端に長い場合など、一行にまとめないといけないのは不便です。
“をみっつ付ける方法
#python
print("""hello hello hello hello hello hello
hello hello hello hello world""")
“で閉じた文章の場合、“をみっつ繋げて文字を閉じることで、複数行に渡って文章を書く/文章を改行させることができます。

実行結果です。
\nで改行
#python
print("test\ntest\ntest")
または、
""
で閉じた文字列の中にバックスラッシュ(半角の\)n(日本語キーボードだと\n表記)を置くことで、その部分で改行させることができます。
実行結果です。
コードを改行
\で区切る方法
#python
print\
("hello hello hello hello hello hello "\
"hello hello hello hello world")
コードの途中でバックスラッシュ(半角の\)(日本語キーボードだと\表記)で区切ることで、コードを複数行に分けることができます。
文章も一緒に改行してる場合は、一度”で閉じる必要があります。
文章も一緒に改行してる場合は、一度”で閉じる必要があります。

実行結果です。この方法だと、文章を複数行に分けて書きつつ、出力では改行させないことができます。

Python操作方法、関数・メソッドリファレンス
使用用途別にまとめたPythonリファレンスページです。
初期準備、基本概念
ダウンロード、インストール、起動
ShellとEditor、保存、実行
保存したPythonの起動
コメント、docstring、行またぎ
コメント、...
コメント