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
  • 484,719
  • 26
  • 302
  • 397
Surender Raja
  • 3,191
  • 6
  • 35
  • 64

0 Answers0