help me debug my "word capitalizer" script
Kamil Kuduk
kamil.kuduk at gmail.com
Wed Aug 22 07:06:06 EDT 2012
On Wed, Aug 22, 2012 at 12:41 PM, Chris Angelico <rosuav at gmail.com> wrote:
> Why less? Why not just redirect input?
Yeah, my bad, I somehow used to do it, for grep too, and I know that
this is slower
> Though, this isn't really on topic for Python.
I would still go with regexp, something like:
with open('myfile.txt', 'rw) as file:
print "".join(re.sub(r'\w{3,}', lambda(match):
match.group(0).title(), line) for line in file)
More information about the Python-list
mailing list