创建字符串 var1 = "world" var2 = "python" var3 = """ hello world python """ print (var1 var2 var3) 输出结果: world python hello world python
字符串的拼接方法一 var1 = "hello" var2 = "python" print (var1 +" "+ var2) 输出结果: hello python
字符串的拼接方法二
var1 = "python"
var2 = "world"
var3 = ‘‘.jion([a,b])
字符串乘法
var1 = "python " print (var1*5) 输出结果: python python python python python
字符串续行("\"续行符) var1= """ hello worldpython """ print (var1) 输出结果: hello world python ----------------------------- 不使用续行符的结果 var1= """ hello world python """ print (var1) 输出结果: hello wordl python