split()方法
split 英 /splɪt/ v. 分裂,使分裂(成不同的派别);分开,使分开(成为几个部份);(使)撕裂;分担,分享;划破,割破;结束婚姻(或感情、工作)关系;<旧,非正式>迅速离开;使(原子)产生核裂变;<英,非正式>泄露(某人的)秘密,告发某人;<非正式>(头)剧痛
作用:
对字符串进行 切割 操作,返回一个list()列表类型的数据
案例:
对字符串 'apple-banana-orange' 进行分割。
代码:
str1 = 'apple-banana-orange'
print(str1.split('-'))
print(str1.split('*'))
print(str1.split(' '))
str2 = 'apple-banana-orange'
print(str2.split('a'))
str3 = 'apple banana orange'
print(str3.split(' '))
str4 = 'apple*banana*orange'
print(str4.split('*'))
图示:












![[C/C++]数据结构 链表OJ题: 链表分割](https://img-blog.csdnimg.cn/e83bd78a0e484286b71df9472560503e.png)


![[动态规划] (十) 路径问题 LeetCode 174.地下城游戏](https://img-blog.csdnimg.cn/img_convert/564dbdb8c3471240feac7343a8771b57.png)



