Python Forum
Python capitalize() method problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python capitalize() method problem
#2
Hello and welcome to Python and the forums!

You can split the string, use capitalize() only on first word, and then put strings back together.

You can also use string's upper() method. It changes all characters in string to upper case. So you can slice the string and change only first character to upper, and leave the rest as they are.
Reply


Messages In This Thread
Python capitalize() method problem - by Skipper - Jan-27-2018, 02:16 PM
RE: Python capitalize() method problem - by j.crater - Jan-27-2018, 02:28 PM
RE: Python capitalize() method problem - by Skipper - Jan-27-2018, 02:45 PM
RE: Python capitalize() method problem - by buran - Jan-27-2018, 02:48 PM
RE: Python capitalize() method problem - by Mekire - Jan-27-2018, 02:51 PM
RE: Python capitalize() method problem - by buran - Jan-27-2018, 02:53 PM
RE: Python capitalize() method problem - by Mekire - Jan-27-2018, 02:59 PM
RE: Python capitalize() method problem - by Skipper - Jan-27-2018, 03:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  class definition and problem with a method HerrAyas 2 292 Apr-01-2024, 03:34 PM
Last Post: HerrAyas
  problem usage of static method akbarza 5 572 Feb-03-2024, 07:43 AM
Last Post: paul18fr
  How to capitalize in dictionary Inkanus 2 3,713 Oct-28-2020, 01:20 PM
Last Post: Inkanus
  Find and replace to capitalize with Regex hermobot 2 2,543 Mar-21-2020, 12:30 PM
Last Post: hermobot
  Problem with adding arbitrary parrameters to __init__ method sebastianvdn 1 2,009 Feb-03-2020, 09:30 PM
Last Post: micseydel
  [split] capitalize dict keys for display in string newbieAuggie2019 3 3,034 Oct-10-2019, 10:50 AM
Last Post: perfringo
  problem with class method AmirAB 3 3,429 Feb-13-2019, 01:51 AM
Last Post: AmirAB

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020