capitalize() method in Python/Django
capitalize() method in python/Django converts the first character of a string to capital letter i.e. uppercase. If the string has its first character as capital, then it returns the original string.
capitalize() method in python/Django converts the first character of a string to capital letter i.e. uppercase. If the string has its first character as capital, then it returns the original string.
name = "hello world" print(name.capitalize()) name1 = "Hello World" print(name1.capitalize()) result:Hello World
name2 = "HELLO WORLD" print(name2.capitalize()) result:Hello World
name4 = "TRUE" print(name4.capitalize()) result:True
name5 = "FALSE" print(name5.capitalize()) result:False
Comments
Post a Comment