切片:
s = "Hello, World!"
print(s[0:5]) # 输出 "Hello"
print(s[7:12]) # 输出 "World"
拼接:
s1 = "Hello"
s2 = "World"
print(s1 + " " + s2) # 输出 "Hello World"
切片:
s = "Hello, World!"
print(s[0:5]) # 输出 "Hello"
print(s[7:12]) # 输出 "World"
拼接:
s1 = "Hello"
s2 = "World"
print(s1 + " " + s2) # 输出 "Hello World"