fork download
  1. import re
  2. stack_loc = ['laptop/k8s-tv-01.ibm.com/tv-And_some_text']
  3. rx = re.compile(r'laptop/k8s-tv-01.ibm.com/tv-')
  4. print( [x for x in stack_loc if rx.match(x)] )
  5. # or with startswith
  6. print( [x for x in stack_loc if x.startswith('laptop/k8s-tv-01.ibm.com/tv-')] )
Success #stdin #stdout 0.03s 9392KB
stdin
Standard input is empty
stdout
['laptop/k8s-tv-01.ibm.com/tv-And_some_text']
['laptop/k8s-tv-01.ibm.com/tv-And_some_text']