Python string case conversion
The following code demonstrates how to convert a string to uppercase or lowercase letters, and so the string:
# Filename : test.py # author by : www.w3big.com str = "www.w3big.com" print(str.upper()) # 把所有字符中的小写字母转换成大写字母 print(str.lower()) # 把所有字符中的大写字母转换成小写字母 print(str.capitalize()) # 把第一个字母转化为大写字母,其余小写 print(str.title()) # 把每个单词的第一个字母转化为大写,其余小写
Execute the above code output results:
WWW.w3big.com www.w3big.com Www.w3big.com Www.w3big.com