str1 = "Hello"
str2 = "World"
result = str1 + " " + str2
print(result) # Output: Hello World
str1 = "Hello"
str2 = "World"
print(str1, str2) # Output: Hello World
str1 = "Hello"
str2 = "World"
result = " ".join([str1, str2])
print(result) # Output: Hello World
str1 = "Hello"
str2 = "World"
result = f"{str1} {str2}"
print(result) # Output: Hello World
str1 = "Hello"
str2 = "World"
result = "{} {}".format(str1, str2)
print(result) # Output: Hello World
str1 = "Hello"
str2 = "World"
result = "%s %s" % (str1, str2)
print(result) # Output: Hello World
str1 = "Hello"
str2 = "World"
result = " ".join([word for word in [str1, str2]])
print(result) # Output: Hello World
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:JS截取字符串(3种方法)