字串 (string) 型態 (type) 的 lower() 方法 (method) ,將 str 的英文字母都改成小寫
方法 | 描述 |
str.lower() | 將 str 的英文字母都改成小寫 |
舉例示範如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | a = "puppy"
b = "Puppy"
c = "PUPPY"
d = "pUpPy"
print (a)
print (a.lower())
print ()
print (b)
print (b.lower())
print ()
print (c)
print (c.lower())
print ()
print (d)
print (d.lower())
print ()
|
執行結果如下
中英文術語對照 |
字串 | string |
型態 | type |
方法 | method |
內建型態
- 數字型態 int float complex 按一下展開目錄
- 迭代器型態
- 序列型態 按一下展開目錄
- 字串 str 按一下展開目錄
- str.capitalize()
- str.center(width[, fillchar])
- str.count(sub[, start[, end]])
- str.encode(encoding="utf-8", errors="strict")
- str.endswith(suffix[, start[, end]])
- str.expandtabs([tabsize])
- str.find(sub[, start[, end]])
- str.format(*args, **kwargs)
- str.index(sub[, start[, end]])
- str.isalnum()
- str.isalpha()
- str.isdecimal()
- str.isdigit()
- str.isidentifier()
- str.islower()
- str.isnumeric()
- str.isprintable()
- str.isspace()
- str.istitle()
- str.isupper()
- str.join(iterable)
- str.ljust(width[, fillchar])
- str.lower()
- str.lstrip([chars])
- static str.maketrans(x[, y[, z]])
- str.partition(sep)
- str.replace(old, new[, count])
- str.rfind(sub[, start[, end]])
- str.rindex(sub[, start[, end]])
- str.rjust(width[, fillchar])
- str.rpartition(sep)
- str.rsplit([sep[, maxsplit]])
- str.rstrip([chars])
- str.split([sep[, maxsplit]])
- str.splitlines([keepends])
- str.startswith(prefix[, start[, end]])
- str.strip([chars])
- str.swapcase()
- str.title()
- str.translate(map)
- str.upper()
- str.zfill(width)
- range
- 串列 list 按一下展開目錄
- 序對 tuple
- 字節 bytes 按一下展開目錄
- 字節陣列 bytearrary 按一下展開目錄
- 集合型態 set frozenset 按一下展開目錄
- 配對型態 dict 按一下展開目錄
沒有留言:
張貼留言