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


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

Re: help me debug my "word capitalizer" script

Started byKamil Kuduk <kamil.kuduk@gmail.com>
First post2012-08-22 12:28 +0200
Last post2012-08-23 00:34 -0700
Articles 3 — 2 participants

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 12:28 +0200
    Re: help me debug my "word capitalizer" script John Ladasky <john_ladasky@sbcglobal.net> - 2012-08-23 00:34 -0700
    Re: help me debug my "word capitalizer" script John Ladasky <john_ladasky@sbcglobal.net> - 2012-08-23 00:34 -0700

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

FromKamil Kuduk <kamil.kuduk@gmail.com>
Date2012-08-22 12:28 +0200
SubjectRe: help me debug my "word capitalizer" script
Message-ID<mailman.3643.1345631321.4697.python-list@python.org>
> Purpose of the script:
> To capitalize the first letter of any word in a given file, leaving
> words which have 3 or less letters.

First or all? If first and this is the only purpose of the script you
can easily use sed:
less file.txt | sed -e "s/\b\([a-z]\{4,\}\)/\u\1/g"

[toc] | [next] | [standalone]


#27701

FromJohn Ladasky <john_ladasky@sbcglobal.net>
Date2012-08-23 00:34 -0700
Message-ID<5c2b4fbc-ca67-4171-a1aa-480f8d9c6fad@googlegroups.com>
In reply to#27625
On Wednesday, August 22, 2012 3:28:18 AM UTC-7, Kamil Kuduk wrote:

> less file.txt | sed -e "s/\b\([a-z]\{4,\}\)/\u\1/g"

Say what?

Yes, you could do a crazy regex at the Linux prompt.  But... will you be able to retain that insane syntax in your head until the NEXT time you need to write something like that?  Probably not, unless you write awk all day.

That, ladies and gentlemen, is why there's Python.

I stopped programming for about 18 months a while back.  When I came back to Python and needed to do it again, I picked up right where I left off.

[toc] | [prev] | [next] | [standalone]


#27702

FromJohn Ladasky <john_ladasky@sbcglobal.net>
Date2012-08-23 00:34 -0700
Message-ID<mailman.3696.1345707275.4697.python-list@python.org>
In reply to#27625
On Wednesday, August 22, 2012 3:28:18 AM UTC-7, Kamil Kuduk wrote:

> less file.txt | sed -e "s/\b\([a-z]\{4,\}\)/\u\1/g"

Say what?

Yes, you could do a crazy regex at the Linux prompt.  But... will you be able to retain that insane syntax in your head until the NEXT time you need to write something like that?  Probably not, unless you write awk all day.

That, ladies and gentlemen, is why there's Python.

I stopped programming for about 18 months a while back.  When I came back to Python and needed to do it again, I picked up right where I left off.

[toc] | [prev] | [standalone]


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


csiph-web