Latest web development tutorials

conversione caso stringa di Python

Document Object Reference Esempi python3

Il codice seguente illustra come convertire una stringa in lettere maiuscole o lettere minuscole, e quindi la stringa:

# Filename : test.py
# author by : www.w3big.com

str = "www.w3big.com"
print(str.upper())          # 把所有字符中的小写字母转换成大写字母
print(str.lower())          # 把所有字符中的大写字母转换成小写字母
print(str.capitalize())     # 把第一个字母转化为大写字母,其余小写
print(str.title())          # 把每个单词的第一个字母转化为大写,其余小写 

Eseguire i risultati di output di codice di cui sopra:

WWW.w3big.com
www.w3big.com
Www.w3big.com
Www.w3big.com

Document Object Reference Esempi python3