0

How do i select only the files that starts with either CH or OTC

import re

#Check if the string starts with "The" and ends with "Spain":

txt = "ho rain in Spain"
x = re.search("^[The|he]", txt)

if x:
  print("YES! We have a match!")
else:
  print("No match")

This shows result as YES! We have a match , but i want result as "No match"

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Surender Raja
  • 3,553
  • 8
  • 44
  • 80

0 Answers0