>>> sample7 = """including 'quote1' "quote2" and 'quote3" """
>>> sample7
'including \'quote1\' "quote2" and \'quote3" '
>>> print sample7
including 'quote1' "quote2" and 'quote3"
Here, the quotes inside the string sample7
was properly escaped by the triple quotes. But,
>>> sample4 = """c:\ntext\text\file.rtf"""
>>> sample4
'c:\ntext\text\x0cile.rtf'
>>> print sample4
c:
text extile.rtf
The backslashes in sample4
were not properly escaped by the triple quote. Why is that? What should be done to escape that automatically. Something like,
String file = @"c:\ntext\text\file.rtf";
in C#.
PS. Also, how did I get \\x0cile.rtf
instead of \\file.rtf
?
Thanks.
Python正在评估\\ f仅使用原始字符串
r"c:\ntext\text\file.rtf"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.