Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27625 > unrolled thread
| Started by | Kamil Kuduk <kamil.kuduk@gmail.com> |
|---|---|
| First post | 2012-08-22 12:28 +0200 |
| Last post | 2012-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.
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
| From | Kamil Kuduk <kamil.kuduk@gmail.com> |
|---|---|
| Date | 2012-08-22 12:28 +0200 |
| Subject | Re: 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]
| From | John Ladasky <john_ladasky@sbcglobal.net> |
|---|---|
| Date | 2012-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]
| From | John Ladasky <john_ladasky@sbcglobal.net> |
|---|---|
| Date | 2012-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