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