首页 > 代码库 > python 跟踪IP模块

python 跟踪IP模块

 

#coding=utf-8

import re
import subprocess

def tracertIP(ip):
  p = subprocess.Popen([‘tracert‘,ip],stdout=subprocess.PIPE)
  while True:
    line = p.stdout.readline()
    if not line:
      break
    print line

tracertIP(‘192.168.2.1‘)

 

python 跟踪IP模块