import unittest

# d = {
#     'a': 1,
#     'b': 2,
#     'c': 3,
# }
# # 循环 遍历这个 ditc d
#
#
# for k, v in d.items():
#     print(k, v)

devices = ['List of devices attached', '127.0.0.1:51024\toffline', '127.0.0.1:51341\tdevice', '']

a = [x for x in devices if x and ':' in x]
print(a)
a = [x.split('\t')[0] for x in a if x.split('\t')[1] != 'offline']

print(a)
