字符串
Python 3
中的字符串是str
类型。
此处整理和str
相关的内容。
多行字符串
一般写法:
normal_multiple_line_str = """line 1
line 2
line 3
...
"""
另外一种写法:
my_very_big_string = (
"For a long time I used to go to bed early. Sometimes, "
"when I had put out my candle, my eyes would close so quickly "
"that I had not even time to say “I’m going to sleep.”"
)
注:多行字符串往往也被用于注释