Python String Case Conversion
The following code demonstrates how to convert a string to uppercase letters, or convert a string to lowercase letters, etc.:
# Filename : test.py # author by : www.example.com str = "www.example.com" print(str.upper()) # 把所有字符中的小写字母转换成大写字母 print(str.lower()) # 把所有字符中的大写字母转换成小写字母 print(str.capitalize()) # 把第一个字母转化为大写字母,其余小写 print(str.title()) # 把每个单词的第一个字母转化为大写,其余小写
Executing the above code produces the following output:
WWW.example.com www.example.com Www.example.com Www.example.comOther Extensions
Python3 Examples