You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
String literals can span multiple lines. One way is using triple-quotes: """...""" or '''...'''. End of lines are automatically included in the string, but it’s possible to prevent this by adding a \ at the end of the line.
这句话的意思,默认情况下,会有1个 换行 字符包括到那个多行字符串里。但是中文文档里说 加在字符串 行尾, https://docs.python.org/zh-cn/3.9/tutorial/introduction.html
实际是加在 字符串 开头。
测试代码:
a ="""
Usage: thingy [OPTIONS]
-h Display this usage message
-H hostname Hostname to connect to
"""
print('a变量的长度是',len(a))
print('a变量第一个字符的ASCii是',ord(a[0]))
b="""
Usage: thingy [OPTIONS]
-h Display this usage message
-H hostname Hostname to connect to
"""
print('b变量的长度是',len(b))
print('b变量第一个字符的ASCii是',ord(b[0]))