How can Python convert lowercase letters to uppercase letters?

In Python, you can use the upper() function to convert lowercase letters to uppercase.

Here is an example:

# 将小写字母转化为大写字母
string = 'hello world'
uppercase_string = string.upper()

print(uppercase_string)

The output is:

HELLO WORLD

In the example above, the upper() function is used to convert lowercase letters in the string ‘string’ to uppercase, and assign the result to the variable uppercase_string. Finally, the print() function is used to print the result.

bannerAds