对python的bytes类型数据split分割切片方法
来源:
中文源码网 浏览:450 次 日期:2024-04-27 15:59:27
【下载文档: 对python的bytes类型数据split分割切片方法.txt 】
对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分割切片方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持中文源码网。