- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10-python-string-methods.py
More file actions
Latest commit
27 lines (27 loc) · 880 Bytes
/
Copy path10-python-string-methods.py
File metadata and controls
27 lines (27 loc) · 880 Bytes
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
print("upper".upper())
print("Lower".lower())
print("capitalize".capitalize())
print("title title".title())
print("Hello World".count('World'))
print("Hello World".find("World"))
print("Hello World World".rfind("World"))
print("100".isdigit())
print("QWERTY123qwerty".isalnum())
print("QWERTYqwerty".isalpha())
print("QWERTY qwerty".isalpha())
print("qwerty".islower())
print("QWERTY".isupper())
print("Hello World".istitle())
print(" ".isspace())
print(" - ".isspace())
print("Hello World".startswith("H"))
print("Hello World".endswith("d"))
print("H E L L O".split())
print("HELLO, world".split(','))
print(",".join("Hello World"))
print(" ".join("Hello"))
print(" Hello World".strip())
print("-----Hello World-----".strip('-'))
print("Hello world".replace('o', '0'))
print("Hello world".replace('world', 'replace'))
print("Hello world world world".replace(' world', '', 2))