学习笔记(03):Python 面试100讲(基于Python3.x)-各种类型的变量与值之间的多种连接方式...

立即学习:https://edu.csdn.net/course/play/26755/340111?utm_source=blogtoedu

字符串与字符串连接的方式

1. “+”

2. s = "hello""world"(+可以省略)

3. ","连接,标准输出重定向

4. 格式化 s = '<%s> <%s>' %(s1,s2)

5. join连接

 s = " ".join([s1,s2])    " "为连接符

字符串与非字符连接

1. “+”

2. 格式化

3. 重定向

字符串与对象连接

重写str方法

发布了18 篇原创文章 · 获赞 6 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/weixin_39938635/article/details/104275854