Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #27627 > unrolled thread

Re: help me debug my "word capitalizer" script

Started byKamil Kuduk <kamil.kuduk@gmail.com>
First post2012-08-22 13:06 +0200
Last post2012-08-22 13:06 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: help me debug my "word capitalizer" script Kamil Kuduk <kamil.kuduk@gmail.com> - 2012-08-22 13:06 +0200

#27627 — Re: help me debug my "word capitalizer" script

FromKamil Kuduk <kamil.kuduk@gmail.com>
Date2012-08-22 13:06 +0200
SubjectRe: help me debug my "word capitalizer" script
Message-ID<mailman.3645.1345633589.4697.python-list@python.org>
On Wed, Aug 22, 2012 at 12:41 PM, Chris Angelico <rosuav@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)

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web