2
import re
a = ('''
Gi1/0 up up test
Fa2/0 up up CloudInterface
Fa2/1 up up CloudInterface
Fa3/0 up up test
''')
for b in a:
b = a.split("\n")
for line in b:
if 'CloudInterface' in b:
line = b.split(' ') [0]
print (line)
#
「」」 我怎樣才能得到下面的值?副本屬性上線Python表達式
Fa2/0
Fa2/1
https://stackoverflow.com/help/how-to-ask –