打算开始更一些Python基础文章,因为已经反复学习过基础语法三次,但使用频率不高,忘记的较快,算是给自己记录一份笔记吧
字符串就是一系列字符,在Python
中,字符串是用引号包裹起来的,可以是单引号,也可以是双引号,如:
"String"
'String'
word = "Sometimes ever. sometimes never"
print(word.title())
word = "Sometimes ever. sometimes never"
print(word.upper())
word = "Sometimes ever. sometimes never"
print(word.lower())
word_one = "Sometimes ever."
word_two = "sometimes never"
word = word_one + " " + word_two + "!"
print(word)
print("\tSometimes ever.")
print("\nSometimes ever. \nsometimes never")
word = "Sometimes ever. sometimes never "
print(word.rstrip())
word = " Sometimes ever. sometimes never"
print(word.lstrip())
word = " Sometimes ever. sometimes never "
print(word.strip())