-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path7-Strings Methods Part 3.py
More file actions
77 lines (56 loc) · 1.35 KB
/
7-Strings Methods Part 3.py
File metadata and controls
77 lines (56 loc) · 1.35 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# ---------------------
# -- Strings Methods --
# ---------------------
# index(SubString, Start, End)
a = "I Love Python"
# print(a.index("P")) # Index Number 7
# print(a.index("P", 0, 10)) # Index Number 7
# print(a.index("P", 0, 5)) # Through Error
# find(SubString, Start, End)
b = "I Love Python"
print(b.find("P")) # Index Number 7
print(b.find("P", 0, 10)) # Index Number 7
print(b.find("P", 0, 5)) # -1
# rjust(Width, Fill Char) ljust(Width, Fill Char)
c = "Osama"
print(c.rjust(10))
print(c.rjust(10, "#"))
d = "Osama"
print(d.ljust(10))
print(d.ljust(10, "#"))
# splitlines()
e = """First Line
Second Line
Third Line"""
print(e.splitlines())
f = "First Line\nSecond Line\nThird Line"
print(f.splitlines())
# expandtabs()
g = "Hello\tWorld\tI\tLove\tPython"
print(g.expandtabs(2))
one = "I Love Python And 3G"
two = "I Love Python And 3g"
print(one.istitle())
print(two.istitle())
three = " "
four = ""
print(three.isspace())
print(four.isspace())
five = 'i love python'
six = 'I Love Python'
print(five.islower())
print(six.islower())
seven = "osama_elzero"
eight = "OsamaElzero100"
nine = "Osama--Elzero100"
print(seven.isidentifier())
print(eight.isidentifier())
print(nine.isidentifier())
x = "AaaaaBbbbbb"
y = "AaaaaBbbbbb111"
print(x.isalpha())
print(y.isalpha())
u = "AaaaaBbbbbb"
z = "AaaaaBbbbbb111"
print(u.isalnum())
print(z.isalnum())