注意,三重引号可以轻松地处理多行XML文档。
Notice that the triple quotes handle the multiline XML document with ease.
另外,字符串可以用一对三重引号”””或'''来标识。
Or, strings can be surrounded in a pair of matching triple-quotes: """ or '.
三重引号中的字符串在行尾不需要换行标记,所有的格式都会包括在字符串中。
End of lines do not need to be escaped when using triple-quotes, but they will be included in the string.
Groovy的三重引号(在其他语言中通常称作heredoc)使得在内部存储XML变得非常轻松,如清单4所示。
Groovy's triple quotes (commonly called a HereDoc in other languages) make it effortless to store the XML internally, as shown in Listing 4.
在一个字符串上调用。r会把它变成一个正则表达式;我们是用了原始(三重引号)字符串来避免诸多双重转义的反斜杠。
Calling.r on a string turns it into a regular expression; we use raw (triple-quoted) strings here to avoid having to double-escape backslashes.
使用单引号或三重引号的字符串前面可以加一个字母“r ”以表示Python不应该解释规则表达式特殊字符。
Both single-quoted or triple-quoted strings may be preceded by the letter "r" to indicate that regular expression special characters should not be interpreted by Python. For example.
使用单引号或三重引号的字符串前面可以加一个字母“r ”以表示Python不应该解释规则表达式特殊字符。
Both single-quoted or triple-quoted strings may be preceded by the letter "r" to indicate that regular expression special characters should not be interpreted by Python. For example.
应用推荐