Q:

Why isn't this python string comparison working as expected

I have the following comparison in python:
"LC08_L1TP_215068_20151114_20170402_01_T1_B1"=="LC08*_B[1-7]"

Which should return True but doesn't. Does anyone know what the problem is, and how to solve it?

A:

You need to use regex. This can be done with the re module. In Python strings are equal only if every character is the same, not with pattern matching. I believe what you are trying to achieve is:
import re

print(re.match("LC08[^B]*_B[1-7]", "LC08_L1TP_215068_20151114_20170402_01_T1_B1") != None)

