instead of using:
var = re.compile('old word',re.ignorecase)
and using:
var2 = var.sub(r'new word', line)
how implement ignorecase
into:
var = re.sub(r'word',r'word',line)
use flags
kwarg:
re.sub(r'word',r'word',line, flags=re.ignorecase)
note it's available in 2.7 or later.
Comments
Post a Comment