Python Join Examples
来源:互联网 发布:黑马程序员找不到工作 编辑:程序博客网 时间:2024/05/21 08:00
原文链接:点我
Overview
This post will show some examples of the Python join method. What is important to remember is that the character that joins the elementsis the one upon which the function is called.
Join Examples
Let's show an example
Creating a new list
>>> music = ["Abba","Rolling Stones","Black Sabbath","Metallica"]>>> print music['Abba', 'Rolling Stones', 'Black Sabbath', 'Metallica']
Join a list with an empty space
>>> print ' '.join(music)Abba Rolling Stones Black Sabbath Metallica
Join a list with a new line
>>> print "\n".join(music)AbbaRolling StonesBlack SabbathMetallica
Join a list with a tab
>>> print "\t".join(music)AbbaRolling StonesBlack SabbathMetallica>>>
Happy scripting!
0 0
- Python Join Examples
- Jython & Python Examples
- Python pika.ConnectionParameters Examples
- Python Basic Examples
- python join
- Python join()
- python .join()
- python-join()
- Python os模块的Examples
- examples
- examples
- AWS s3 python sdk code examples
- Python Spider, Web Crawler, Bot Examples
- Examples of Python Matplotlib to plot bar
- python join的用法
- python thread之join
- python thread之join
- python字符串方法join
- 如何把文件上传到另外一台服务器3
- JS设计模式——中介者模式
- Kubernetes集群搭建与测试
- 江苏电信拥抱“互联网+”,加快混改步伐
- 修改windows注册表
- Python Join Examples
- LeetCode——First Bad Version
- POJ 1129:Channel Allocation 四色定理+暴力搜索
- 集合框架总结——Collection、Iterator、List、Set、Map
- 【转】c++编译原理
- 如何解决MathType公式显示方框
- matlab中repmat函数的用法
- java中的匿名内部类总结
- spring 解读之 DI 、AOP