python 循环读取ini中ip 地址及ping方法

我有一个放入ip 地址 ini 文件

[address]
#IP
test_IP=10.10.101.10,10.10.101.11,10.10.101.12,10.10.101.13...............

python
list=cf.get(address,test_IP)

我现在可以根据list 得到ini中多个ip 地址,我现在想通过循环ping list中每个ip 怎样处理? 谢谢。希望是实例 不是理论


import os
test_IP=['10.10.101.10','10.10.101.11','10.10.101.12']
for ip in test_IP:
    cmd = 'ping' + ' ' + ip
    res = os.popen(cmd)
    out_put = res.read()
    print(out_put)
for k in list:
  print(os.system("ping %s"%k))

有用记得采纳哦~