forked from easyawslearn/Python-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathString-start-with.py
More file actions
41 lines (34 loc) · 1.05 KB
/
String-start-with.py
File metadata and controls
41 lines (34 loc) · 1.05 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
##############################################
####### Python exampleing Start with and End with
###############################################
# Python exampleing method startswith()
# checks whether exampleing starts with example,
# optionally reexampleicting the matching
# with the given indices start and end.
# Syntex example.startswith(example, beg=0,end=len(exampleing));
example = "python";
print ("example start with p")
print example.startswith( 'p' )
# output is
# example start with p
# True
print ("example start with P")
print example.startswith( 'P' )
# output is
# example start with P
# False
print ("example start with Y")
print example.startswith( 'y' )
# output is
# example start with Y
# False
print ("example start with y at index 1")
print example.startswith( 'y', 1 )
# output is
# example start with y at index 1
# True
print ("example start with y at index 1 till 4 length of string")
print example.startswith( 'y', 1, 4 )
# output is
# example start with y at index 1 till 4 length of string
# True