使用正则表达式匹配模式

2024-09-29 21:38:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个字符串,我想使用正则表达式从整个字符串中提取一行

这是我的字符串:

Physical interface: rt90, Enabled, Helical link is Up
Interface index: 178, SPMZ ifIndex: 980
Description: 4&109G LAG to kah7zt84
Link-level type: Ethernet, XCU: 9082, Speed: 10Gbps, BPDU Error: Hello,
Wind-REWRITE Error: None, Loopback: Disabled, Source filtering: abled,
Flow : abled
Pad to min frame size0: Disabled
Minimum li needed: 1, Minimum bandwidth need: 0bps
Device flags   : Running
Interface flags: RTYU-Traps Internal: 0x40
Current address: 1e:pb:i0:90:10:76, Hardware address: 1e:pb:i0:90:10:768
Last flapped   : 2017-12-16 32:12:12 GMT (3d 16:16 ago)
Input rate     : 115 bps (20 pps)
Output rate    : 8 bps (1 pps)`

我想提取以下行:

Physical interface: rt90, Enabled, Helical link is Up

(第一行)

有人能帮忙吗? 谢谢


Tags: to字符串islinkenablederrorinterfaceup

热门问题