对python的bytes类型数据split分割切片方法,


对str类型数据进行split操作如下:

>>> s = 'abc\ndef'
>>> s.split('\n')
['abc', 'def']

对bytes类型数据进行split操作如下:

>>> b = b'abc\ndef'
>>> b.split(b'\n')
[b'abc', b'def']

测试Python版本:3.6.5

以上这篇对python的bytes类型数据split分割切片方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编橙之家。

评论关闭