① 单引号和双引号主要用来表示字符串
# 单引号''
astr = 'Python'
print(type(astr)) # <class 'str'># 双引号""
bstr = "Python"
print(type(bstr)) # <class 'str'>
str1 = 'I\'m a big fan of Python.'
print(str1) # I'm a big fan of Python.str2 = "We all know that 'A' and 'B' are two capital letters."
print(str2) # We all know that 'A' and 'B' are two capital letters.str3 = 'The teacher said: "Practice makes perfect" is a very famous proverb.'
print(str3) # The teacher said: "Practice makes perfect" is a very famous proverb.
当你用单引号' '定义字符串的时候,它就会认为你字符串里面的双引号" "是普通字符,从而不需要进行转义;反之当你用双引号" "定义字符串的时候,它就会认为你字符串里面的单引号' '是普通字符也无需进行转义