当前位置:主页 > 软件编程 > Python代码 >

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

时间:2021-10-19 08:56:43 | 栏目:Python代码 | 点击:

对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

您可能感兴趣的文章:

相关文章