psutil学习

本文介绍了如何使用psutil库获取系统网络接口的详细信息,包括net_if_addrs()函数返回的地址信息,net_if_stats()提供的网络接口状态,如速度、双工模式和MTU,以及net_io_counters()统计的网络I/O数据。
摘要由CSDN通过智能技术生成

1.  net_if_addrs()

    Return the addresses associated to each NIC (network interface
    card) installed on the system as a dictionary whose keys are the
    NIC names and value is a list of namedtuples for each address
    assigned to the NIC. Each namedtuple includes 5 fields:

     - family
     - address
     - netmask
     - broadcast
     - ptp

    'family' can be either socket.AF_INET, socket.AF_INET6 or
    psutil.AF_LINK, which refers to a MAC address.
    'address' is the primary address and it is always set.
    'netmask' and 'broadcast' and 'ptp' may be None.
    'ptp' stands for "point to point" and references the destination
    address on a point to point interface (typically a VPN).
    'broadcast' and 'ptp' are mutually exclusive.

    Note: you can have more than one address of the same

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值