0

I have a string like this: "CURICO 394 DEPTO 1013"

and I want this output

"Curico 394 Depto 1013"

How could I accomplish that in Python 2.7?

ares1986
  • 528
  • 4
  • 11
  • 6
    `"CURICO 394 DEPTO 1013".title()`? It works, but judging by your title, you’ve tried that, so what happened? – Ry- Aug 16 '14 at 02:59
  • Check out this `.capwords` function, here: https://docs.python.org/2/library/string.html#string-functions – Bla... Aug 16 '14 at 03:00
  • This should do it: https://launchpad.net/titlecase.py/trunk/0.2 – Len_D Aug 16 '14 at 03:02
  • 1
    ares1986 - please answer @minitech's question. why does `.title()` not work for you? – Mark Reed Aug 16 '14 at 04:15
  • Actually, minitech answers is the correct. I tried it but the particular example had some accent in between and for that reason it wasn't working. For the example that I put there, the correct answer is to simple use .title(). Thanks to everyone! – ares1986 Aug 16 '14 at 19:30

0 Answers0