Transform uppercase to lowercase with python

Published: January 07, 2019 Protection Status

Python function lower can be used to transform uppercase to lowercase, example:

>>> s = "HELLO"
>>> s = s.lower()
>>> s

If we want to transform all letters to lowercase and uppercase the first letter, one can use the method capitalize() , example:

>>> s = 'HELLO WORLD'
>>> s.capitalize() 
'Hello world'

Note that with the python framework django, the tag title can be used in a template to get similar results::

{{ "name"|title }}