Skip to content

Instantly share code, notes, and snippets.

@rswofxd
rswofxd / Netflow.py
Created May 25, 2012 09:58
Python:网卡流量统计实现
#coding:utf-8
import re,time
def get_net_info():
flow1 = open('/proc/net/dev')
lines = flow1.read()
flow1.close()
e = re.compile('(eth.)')
r_re = re.compile('eth..(.*?\s)')