# python字符串 创建可以使用给单引号,也可以使用双引号 str1 = "hello world!" str2 = 'nice to meet you!' str3 = 'i told my friend "she is beautiful"' # 单双引号混合使用特殊语句 str4 = "my dog's name is andy" print("str3=",str3) print("str4=",str4) str5 = "您的航班"+'MH370'+"次准备起飞" # 字符串拼接使用"+"连接 str6 = "MH"+str(370) # 拼接必须强制转换成字符串 print("str5=",str5) print("str6",str6) # python 字符串大小写转换 str7 = str1.lower() # 全小写 str8 = str2.upper() # 全大写 str9 = str3.capitalize() # 首字母大写 str10 = str4.title() # 每个单词首字母大写 str11 = str5.swapcase() # 大小写互换 print("str7=",str7) print("str8=",str8) print("str9=",str9) print("str10=",str10) print("str11=",str11) # py