How to check whether a string starts with XXXX in Python?
import re exp_str = "Python Programming" # Example 1 if re.match(r'^Python', exp_str): print(True) else: print(False) # Example 2 result = exp_str.startswith("Python") print(result)
Sample output of above program.
True
True
2019-07-11T11:43:09+05:30
2019-07-11T11:43:09+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution