Python有三重引號字符串,它提供了自由文本輸入。不需要下一行字符來定義下一行。這是一個例子;Python中三引號字符串的替代方法Python有
hello = """
This string is bounded by triple double quotes (3 times ").
Unescaped newlines in the string are retained, though \
it is still possible\nto use all normal escape sequences.
Whitespace at the beginning of a line is
significant. If you need to include three opening quotes
you have to escape at least one of them, e.g. \""".
This string ends in a newline.
"""
所以我有一個HTML文本,其中包含段落。我可以在段落之間做空格,但我認爲如果JavaScript具有像Python的三重引號字符串這樣的功能,我可以用它生成段落。
Javascript中是否有像Python一樣的自由文本用法,或者您可以建議一個Javascript庫這樣做嗎?
謝謝!
http://stackoverflow.com/questions/805107/creating-multiline-strings-in-javascript – John
Python中的三重引號字符串不僅允許自由範圍定義段落和鏈接。它們還允許引號的字面轉錄。 – wheaties