1.string.join (saq):以string 为分隔符,将seq中所有的元素(字符串表示"")合并成一个新的字符串

2.string.split(str="",num=string.count(str)):以str做分隔符切string,num表示分隔几个字符串

s='a b c'
print s.split(' ')
st='hello world'
print st.split('o')
print st.split('o',1)

--------output---------
['a', 'b', 'c']
['hell', ' w', 'rld']
['hell', ' world']

python split 与join的更多相关文章

  1. 【C++程序员学 python】python split and join 分割与合并

    感觉这名字有点不对,但不知道用什么好,就将就吧. 坑爹啊,居然要把符号放在前面.

  2. 【python】split 和 join函数

    一.关于split 和 join 方法 1只针对字符串进行处理.split:拆分字符串.join连接字符串2.string.join(sep): 以string作为分割符,将sep中所有的元素(字符串 ...

  3. python split函数

    Python split()通过指定分隔符对字符串进行切片,如果参数num 有指定值,则仅分隔 num 个子字符串 例 current_month = "2013-01-02" y ...

  4. python split()函数

    Python split()函数 函数原型: split([char][, num])默认用空格分割,参数char为分割字符,num为分割次数,即分割成(num+1)个字符串 1.按某一个字符分割. ...

  5. String Split 和 Join

    很多时候处理字符串数据,比如从文件中读取或者存入 - 我们可能需要加入分隔符(如CSV文件中的逗号),或使用一个分隔符来合并字符串序列. 很多人都知道使用split()的方法,但使用与其对应的Join ...

  6. 15 Linux Split and Join Command Examples to Manage Large Files--reference

    by HIMANSHU ARORA on OCTOBER 16, 2012 http://www.thegeekstuff.com/2012/10/15-linux-split-and-join-co ...

  7. python里的Join函数

    用法是将数组里的每个元素用字符连接起来 import string string.join(["aaaa", "bbb"]) 或者: from string i ...

  8. C# 中奇妙的函数–7. String Split 和 Join

    很多时候处理字符串数据,比如从文件中读取或者存入 - 我们可能需要加入分隔符(如CSV文件中的逗号),或使用一个分隔符来合并字符串序列. 很多人都知道使用split()的方法,但使用与其对应的Join ...

  9. split和join函数的比较

    关于split和join方法 处理对象字符串.split拆分字符串,join连接字符串 string.join(sep): 以string作为分隔符,将seq中的所有元素(字符串表示)合并成一个新的字 ...

随机推荐

  1. cordova 实现拨打电话-只需两步(H5)

    cordova 实现拨打电话: 第一步配置conf.xml在cordova中所有的URL Schemes 都是服从于白名单的,所以a tel 在这无法正常使用.解决方法是在项目config.xml中添 ...

  2. Java I/O模型从BIO到NIO和Reactor模式(转)

    原创文章,转载请务必将下面这段话置于文章开头处(保留超链接).本文转发自技术世界,原文链接 http://www.jasongj.com/java/nio_reactor/ Java I/O模型 同步 ...

  3. -es6的部分语法

    es6的语法 一 . let 和 var 的区别 : 1 . let 和 val 的区别 :  ES6新增了let命令 , 用来声明变量,它的用法类似于 var (ES5), 但是所声明的变量,只在l ...

  4. 如何设置确认selinux 模式【转】

    本文转载自:http://blog.csdn.net/lei1217/article/details/48377109 [Description]linux SELinux 分成Enforce 以及 ...

  5. JS继承的实现方式

    JS作为面向对象的弱类型语言,继承也是其非常强大的特性之一.那么如何在JS中实现继承呢?让我们拭目以待. JS继承的实现方式 既然要实现继承,那么首先我们得有一个父类,代码如下: // 定义一个动物类 ...

  6. 世界各国Google网址大全

    http://www.oschina.net/question/100896_50293 冰岛 https://www.google.is/ 丹麦 https://www.google.dk/ 挪威  ...

  7. tkinter之button

    Button按钮,直接上代码: from tkinter import * def gs(): global read s=Label(read,text='昨夜西风凋敝树,堵上高楼,望尽天涯路!', ...

  8. codeforces 706A A. Beru-taxi(水题)

    题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...

  9. UVA1389 Hard Life[二分答案+最小割]

    我真菜啊←地址 求最大密度子图方案.密度=边数/点数 假设E,V为最大密度子图的边数点数.则$\forall \rho$有$\rho \leqslant \frac{E}{V}$即$E- \rho V ...

  10. ACM学习历程——HDU5137 How Many Maos Does the Guanxi Worth(14广州10题)(单源最短路)

    Problem Description    "Guanxi" is a very important word in Chinese. It kind of means &quo ...