Python (Scripting) - Upper Lower Case using upper lower
by
Jeremy Canfield |
Updated: October 16 2023
| 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