2024-05-29 04:45:30 发布
网友
[15;1Runts/Jumbos[16;1Errors Rx/Tx[17;1Total Rx Pkts[18;1Tx Pkts[19;1rx MBs[20;1Tx MBs[21;1ARP/ICMP Pkts[23;1Pattern Type[24;1Tx Count/%Rate[25;1PktSize/Tx Burst[26;1Src/Dest Port]
你可以用regex替换。你知道吗
import re string = '[15;1Runts/Jumbos [16;1Errors Rx/Tx [17;1Total Rx Pkts [18;1 Tx Pkts [19;1 Rx MBs [20;1 Tx MBs [21;1ARP/ICMP Pkts [23;1Pattern Type [24;1Tx Count/% Rate [25;1PktSize/Tx Burst [26;1Src/Dest Port' print(re.sub('\[\d{1,2}\;\d','',string)) >>> 'Runts/Jumbos Errors Rx/Tx Total Rx Pkts Tx Pkts Rx MBs Tx MBs ARP/ICMP Pkts Pattern Type Tx Count/% Rate PktSize/Tx Burst Src/Dest Port'
你可以用regex替换。你知道吗
相关问题 更多 >
编程相关推荐