Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
re.match value
#2
Try use re.search() instead.
Don't need all those escape \ to match that line.
try:
    output = subprocess.check_output("edac-util", shell=True)
except subprocess.CalledProcessError as error:
    pass

for line in output.decode().splitlines():
    if re.search(r'mc1: 1257 Corrected Errors with no DIMM info', line):
        print ("match ok")
    else:
        print ("match ko")
Reply


Messages In This Thread
re.match value - by enigma619 - Apr-24-2020, 02:00 PM
RE: re.match value - by snippsat - Apr-24-2020, 02:34 PM
RE: re.match value - by enigma619 - Apr-24-2020, 02:45 PM
RE: re.match value - by bowlofred - Apr-24-2020, 03:52 PM
RE: re.match value - by snippsat - Apr-24-2020, 04:30 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020