先看文档中是怎么说的

    S.split(sep=None, maxsplit=-1) -> list of stringsReturn a list of the words in S, using sep as thedelimiter string.  If maxsplit is given, at most maxsplitsplits are done. If sep is not specified or is None, anywhitespace string is a separator and empty strings areremoved from the result.

也就是说 默认是以空格为分隔符,默认切割整个字符串,返回切分后元素的列表

In [6]: sa='sdj ihwfn sdjf'In [7]: sa.split()
Out[7]: ['sdj', 'ihwfn', 'sdjf']InIn [8]: lis = 'sdlfk lksd oi 123e/&……%& ls'In [9]: lis.split()
Out[9]: ['sdlfk', 'lksd', 'oi', '123e/&……%&', 'ls']

当然了也可以自己指定 分割符和 切割次数


In [10]: ggg = 'ksfdj*ksjdf*kujh*/  *lsdfj'In [11]: ggg.split('*')
Out[11]: ['ksfdj', 'ksjdf', 'kujh', '/  ', 'lsdfj']In [12]: ggg.split('*',2)
Out[12]: ['ksfdj', 'ksjdf', 'kujh*/  *lsdfj']

python 中 str.split( ) 函数相关推荐

  1. Python中的split()函数

    举例详解Python中的split()函数的使用方法 函数:split() Python中有split()和os.path.split()两个函数,具体作用如下: split():拆分字符串.通过指定 ...

  2. Python学习1——Python中的 split() 函数

    函数:split() Python中有split()和os.path.split()两个函数,此处简单介绍split()函数: split():拆分字符串.通过指定分隔符对字符串进行切片,并返回分割后 ...

  3. python 中split函数的应用_举例详解Python中的split()函数的使用方法

    函数:split() python中有split()和os.path.split()两个函数,具体作用如下: split():拆分字符串.通过指定分隔符对字符串进行切片,并返回分割后的字符串列表(li ...

  4. python中的split函数的用法实例_python中的split()函数的用法

    函数:split() Python中有split()和os.path.split()两个函数,具体作用如下: split():拆分字符串.通过指定分隔符对字符串进行切片,并返回分割后的字符串列表(li ...

  5. python中split的用法-python中的split()函数的用法

    函数:split() Python中有split()和os.path.split()两个函数,具体作用如下: split():拆分字符串.通过指定分隔符对字符串进行切片,并返回分割后的字符串列表(li ...

  6. Python中的split()函数的用法

    原文:https://www.cnblogs.com/liujiacai/p/7839971.html Python split() 通过指定分隔符对字符串进行切片,如果参数 num 有指定值,则分隔 ...

  7. Python中的split()函数的详解

    函数说明 str.split(str="",num=string.count(str))[n] 参数说明: str:(参数中的)表示为分隔符,默认为空格,但是不能为空('').若字 ...

  8. python中的 split()函数

    一.描述 split() 通过指定分隔符对字符串进行切片,如果参数 num 有指定值,则分隔 成num+1 个子字符串 二.语法 split() 方法语法: str.split(str="& ...

  9. python语言中split-python中的split()函数和os.path.split()函数使用详解

    Python中有split()和os.path.split()两个函数: split():拆分字符串.通过指定分隔符对字符串进行切片,并返回分割后的字符串列表. os.path.split():将文件 ...

最新文章

  1. 字节终面:CPU 是如何读写内存的?
  2. 释疑のSAP库位的创建
  3. python的self
  4. Silverlight:应用程序模型
  5. JS 中 indexOf 的用户及注意事项
  6. AspectJ——AOP框架快速入门
  7. SpringBoot入门篇--整合mybatis+generator自动生成代码+druid连接池+PageHelper分页插件
  8. java html2text_java-如何在html / text内容中获取文本?
  9. Python演示--UDP套接字真的无连接吗?
  10. Java关系表达式x y,java8--函数式接口,以及和Lambda表达式的关系
  11. surfaceflinger类图
  12. 阿里前 vs 来阿里后,阿里人的真实写照!
  13. 深度学习之目标检测 第4章 深度学习目标检测方法
  14. 基于Matlab的极限学习机(ELM)实现
  15. python ndimage.gaussian_filter_Python ndimage.maximum_filter方法代碼示例
  16. windows底层编程基础
  17. 疫情渐消,政策向好,车企的春天要回来了?
  18. 输入一个整数判断它是奇数还是偶数
  19. iOS自动自动隐藏软键盘
  20. 图片的修改时间就是拍摄时间(家庭相片管理工具之三)

热门文章

  1. 怎样才能保证服务器数据的安全?
  2. Linux:文件压缩解压gz、tar.gz、tar.xz、tar.bz2、tgz、zip
  3. 【 实测可用 】ESP32 + AD8232 心电图实验
  4. CT数据将.nii格式或.nii.gz格式转换为dcm格式
  5. 深度揭秘年薪60W的阿里P7简历制作过程!
  6. 【人脸识别】KL变换人脸识别【含GUI Matlab源码 859期】
  7. 时域特征值提取的MATLAB代码实现(均方根、峰值因子、脉冲因子、裕度因子、峭度因子、波形因子和偏度等)
  8. 【autojs】Auto.js Pro截图取色脚本源代码
  9. Word排版问题——页脚设置
  10. 英雄联盟CG《安妮:从前》的美术创作分享