Bootstrap FreeKB - Python (Scripting) - Upper Lower Case using upper lower
Python (Scripting) - Upper Lower Case using upper lower

Updated:   |  Python (Scripting) articles

upper can be used to make a string or variable upper case. In this example, "Hello World" will become "HELLO WORLD".

#!/usr/bin/python
foo="Hello World"
print(foo.upper())

 

lower can be used to make a string or variable lower case. In this example, "Hello World" will become "hello world".

#!/usr/bin/python
foo="Hello World"
print(foo.lower())

 

capitalize can be used to the first character upper case. In this example, "hello world" will become "Hello world".

#!/usr/bin/python
foo="hello world"
print(foo.capitalize())

 

Here is how you can update a variable to be upper, lower, or capitalize.

#!/usr/bin/python
foo="Hello World"
foo = foo.lower()

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter d10378 in the box below so that we can be sure you are a human.