XML 인덴트 강제 조정
#!/usr/bin/python
# -*- coding: utf-8 -*-

import re

line = 'Cats are smarter than dogs'

matchObj = re.match(r'dogs', line, re.M | re.I)
if matchObj:
    print 'match --> matchObj.group() : ', matchObj.group()
else:
    print 'No match!!'

searchObj = re.search(r'dogs', line, re.M | re.I)
if searchObj:
    print 'search --> searchObj.group() : ', searchObj.group()
else:
    print 'Nothing found!!'

You might also like...

What do you think?