Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
PHPでは、これを行うことができます:
print <<<END This uses the "here document" syntax to output multiple lines END;
Pythonで似たようなことをする方法はありますか?
山かっこなどのエスケープについて心配することなく、HTML の大きなチャンクをダンプしたいと考えています。
Python には、任意の開始/終了マーカーを持つヒアドキュメントがありません。三重引用符 (一重引用符または二重引用符) を使用して、非常によく似たものを実現できます。
print ''' This uses the "here document" syntax to output multiple lines '''
rバックスラッシュも特別に扱われないように、生の文字列にするために an を追加します。r'''....'''
r
r'''....'''