dimanche 19 avril 2015

Python regular expression and my function error

I have tried to write a program that replaced my new input into my output which has been (parentheses).


and there are some mistakes in my program.



a = input("function:")
b = input("device:")
p = re.compile('\(.*?\)')
iterator = p.finditer(s)
for match in iterator:
s = s[:match.start()] + s[match.start():match.end()].replace(match.group(), dict[match.group()]) + s[match.end()]
for result in readciscodevice(a,b):
print(result[0])


After I input the name of function and device it shows that:



iterator = p.finditer(s)
NameError: name 's' is not defined


So what was happening ? Anyone could tell me where is the main problem of these error?


Aucun commentaire:

Enregistrer un commentaire