Python 把一组bytes数据,按每2个字节取出写入一个新数组,如何做到?_百...
发布网友
发布时间:2022-04-27 02:31
我来回答
共1个回答
热心网友
时间:2022-04-18 17:14
dt=[{"ip","sh","li"},{"qw","ty","ko"}] c.extend([i for i in dt if 'ip' in i or 'qw' in i])
Python 3.5.2 (default, Dec 7 2016, 23:38:49)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> dt=[{"ip","sh","li"},{"qw","ty","ko"}]
>>> c=[]
>>> c.extend([i for i in dt if 'ip' in i or 'qw' in i])
>>> c
[{'li', 'sh', 'ip'}, {'ko', 'qw', 'ty'}]