Q:

Why isnt my file recognised when using endswith()

I have written a script that pulls various builds from a server. once I have the build I need, I want to send it to the correct extracting function but first I need to determine what the file endswith (7z, zip, bz2 etc) but my function doesn't seem to be returning any results. I stripped my code down to the basics and this is what I have. When I pass a 7z file to the function it returns nothing. 
target_build = 'C:\\my\\directory\\some_file.7z'

def decide_extract(target_build):
    if target_build.endswith('*.7z'):
        print(target_build)
    else:
        print('No build')

decide_extract(target_build)

A:

.endswith() is already looking at the end of the string, so it is literally looking for "*.7z" to be at the end of the string, "*" is not working as a wildcard in this situation.

