python基础 字符串 拼接字符串 符号‘+’ 的使用

版权声明:伊凡ED原创 https://blog.csdn.net/Ivan_ED/article/details/81972223

python基础 字符串 拼接字符串 + 号的使用


将多个字符串拼接时使用“+”进行合并拼接
例如:

>>>print('hello '+'world')
hello world

“+”不但可以拼接多个字符串还可以拼接两个字符串的赋值
例如:

>>>xxx = 'hello '
>>>ooo = 'world'
>>>print(xxx + ooo)
hello world

猜你喜欢

转载自blog.csdn.net/Ivan_ED/article/details/81972223