O'Reilly logo
  • Andy McGrath thinks this is interesting:

if any(name.endswith('.py') for name in files): print('There be python!') else: print('Sorry, no python.')

From

Cover of Python Cookbook, 3rd Edition

Note

Example using 'if', 'any()' and 'for .. in ..' together