How to check if string starts with specific word in Python

1 Answer

0 votes
s = 'python java c c++ c#'

if (s.startswith('python')):
    print('Starts with \'python\'')
else:
    print('Not start with \'python\'')
  
  
  
'''
run:
  
Starts with 'python'

'''

 



answered Oct 26, 2020 by avibootz
...