var1 = 'Hello World!'
print(var1)
#截取子串
print("var1[1:5]: ", var1[1:5])
print("截取字符串 :- ", var1[:6] + 'Runoob!')

#追加字符串
#a + b 输出结果： HelloPython
#a * 2 输出结果： HelloHello

# 字符串格式化 #同c语言的sprintf()
print("My name is %s and weight is %d kg!" % ('Zara', 21))
55d064f58c5d9f6836763b8559285ad2e143f3c9
<mask token>

<mask token>
print(var1)
print('var1[1:5]: ', var1[1:5])
print('截取字符串 :- ', var1[:6] + 'Runoob!')
print('My name is %s and weight is %d kg!' % ('Zara', 21))

var1 = 'Hello World!'
print(var1)
print('var1[1:5]: ', var1[1:5])
print('截取字符串 :- ', var1[:6] + 'Runoob!')
print('My name is %s and weight is %d kg!' % ('Zara', 21))

var1 = 'Hello World!'
print(var1)
#截取子串
print("var1[1:5]: ", var1[1:5])
print("截取字符串 :- ", var1[:6] + 'Runoob!')

#追加字符串
#a + b 输出结果： HelloPython
#a * 2 输出结果： HelloHello

# 字符串格式化 #同c语言的sprintf()
print("My name is %s and weight is %d kg!" % ('Zara', 21))