Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Key Error in Python
#11
hey , i debug and i thing something wrong here "
m = re.match(r'(\w*-RED\d{0,1}|\w*-BLUE\d{0,1})# sh run vlan \d+', line)
Could you please suggest something for this line ?
Reply
#12
Your RE is wrong. Play with it at RE online tester - paste your text in the tex window, and your RE - in RE widget. Don't forget to switch to Python
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply
#13
hey i identified the issue. i used re.search instead of re.match..i am using python 2.6..its working fine now
Reply


Forum Jump:

User Panel Messages

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