Python ProgrammingPython Programming

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