Python语言技术文档

微信小程序技术文档

php语言技术文档

jsp语言技术文档

asp语言技术文档

C#/.NET语言技术文档

html5/css技术文档

javascript

点击排行

您现在的位置:首页 > 技术文档 > Python编程技巧

Python 连接字符串(join %)

来源:中文源码网    浏览:124 次    日期:2024-05-15 09:35:38
【下载文档:  Python 连接字符串(join %).txt 】


Python 连接字符串(join %)
join 方法用于连接字符串数组 复制代码 代码如下:s = ['a', 'b', 'c', 'd'] print ''.join(s) print '-'.join(s) 输出结果: abcd a-b-c-d 使用 % 连接多个变量 复制代码 代码如下:a = 'hello' b = 'python' c = 1 print '%s %s %s %s' % (a, b, c, s) 输出结果: hello python 1 ['a', 'b', 'c', 'd']

相关内容