美文网首页
python join方法

python join方法

作者: 后来_16db | 来源:发表于2019-06-16 20:42 被阅读0次

    Python join() 方法用于将序列中的元素以指定的字符连接生成一个新的字符串。

    #!/usr/bin/python
    # -*- coding: UTF-8 -*-
     
    str = "-";
    seq = ("a", "b", "c"); # 字符串序列
    print str.join( seq );
    

    结果是
    seq = 'a-b-c'

    相关文章

      网友评论

          本文标题:python join方法

          本文链接:https://www.haomeiwen.com/subject/mbqnfctx.html