我有这个脚本
for row in c:
res = subprocess.Popen('bgpq3 -4 {} -m 24 -l {}'.format(row[5],row[2]), shell=True, universal_newlines=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
stdout, stderr = res.communicate()
lines = []
for line in stdout.split('\n')[1:10]:
lines.append(line)
print(lines)
结果是:
['ip prefix-list 12414 permit 5.57.248.0/21']
['ip prefix-list 12414 permit 5.57.248.0/21', 'ip prefix-list 12414 permit 5.199.144.0/20']
['ip prefix-list 12414 permit 5.57.248.0/21', 'ip prefix-list 12414 permit 5.199.144.0/20', 'ip prefix-list 12414 permit 5.206.208.0/20']
我正在使用 append 方法制作一个大列表,但我得到了很多列表!任何想法?
jeck猫
相关分类