十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
创新互联python教程:

写一个 Python 程序,用一个实际例子连接字符串。
这个 Python 程序允许用户输入两个不同的字符串。接下来,我们使用算术运算符【T1+】来连接这两个字符串。
# Python Program to Concatenate Strings
str1 = input("Please Enter the First String : ")
str2 = input("Please Enter the Second String : ")
concat1 = str1 + str2
print("The Final String After Python String Concatenation = ", concat1)
concat2 = str1 + ' ' + str2
print("The Final After String Concatenation with Space = ", concat2)
如果要连接字符串文字,可以使用以下方法。这两种 Python 方法都意味着工作,无论有没有括号。
# Python Program to Concatenate Strings
concat1 = 'Tutorial ' 'Gateway'
print("The Final String = ", concat1)
concat2 = ('Python ' 'Programming ' 'Examples')
print("The Final String = ", concat2)Python 字符串串联输出
The Final String = Tutorial Gateway
The Final String = Python Programming Examples