AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
用+ 连接两个字符串 同类型的两个字符串 直接连接即可 \>>> "py"+"thon" 'python' 不同类型的,使用强制转换将他们转换成统一类型的 \>>> a=123 \>>> b="hello" \>>> print(a+b) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for +: 'int' and 'str' \>>> print(str(a)+b) #str() 是一种对象类型 123hello \>>> print(repr(a)+b) 123hello \#repr()是函数 \>>>