Difference between revisions of "Python - Regular Expressions"
Jump to navigation
Jump to search
PeterHarding (talk | contribs) (New page: =Using the re Module= <pre> #!/usr/bin/env python #-------------------------------------------------------------------------- import re ... if re.match('esb:', node_name): (na...) |
(No difference)
|
Latest revision as of 14:53, 21 April 2008
Using the re Module
#!/usr/bin/env python
#--------------------------------------------------------------------------
import re
...
if re.match('esb:', node_name):
(name, cnt) = re.subn('esb:', '', node_name)
setattr(service, name, value)
print "service.__dict__ -> '%s'" % service.__dict__
return
if re.match('ns0:', node_name):
(name, cnt) = re.subn('ns0:', '', node_name)