On Fri, Jan 31, 2014 at 9:04 AM, CM <cmpyt...@gmail.com> wrote: > fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] > fake_result = not all(i == '[omitted]' for i in fake_data) > print 'This is fake result: ', fake_result
Trying to get my head around this. You want to see if all the values in fake_data are '[omitted]' or not? That is to say, if there's anything that isn't '[omitted]'? Not sure that that's a normal thing to be asking, but that's what your code appears to do. What happens if you try this? fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] fake_result = set(fake_data)>{'[omitted]'} In theory, that should do the exact same thing as your code (returning True if there's anything in fake_data that is not '[omitted]'). The other thing to try is peppering your code with print statements. Divide the work up into pieces - show the entire loop and what happens - print out everything you can imagine. See where the difference begins between inside and outside the IDE. Once you find that, you'll have a clue as to what's wrong. ChrisA -- https://mail.python.org/mailman/listinfo/python-list