My code is:
if any(s in attrs["show"] for s in ("Apple Mac OS","Intel Mac OS")):
the error is:
if any(s in attrs["show"] for s in ("Apple Mac OS","Intel Mac OS")):
^
SyntaxError: invalid syntax
I could run the same script successfully on one machine, then I just copied it to another machine, it returns this error, really don't know why
asked Aug 3, 2012 at 14:42
manxing
3,33512 gold badges49 silver badges57 bronze badges
-
Could you share a bit more code and your python version?Maksym Polshcha– Maksym Polshcha2012年08月03日 14:45:17 +00:00Commented Aug 3, 2012 at 14:45
1 Answer 1
You have an older version of Python on the machine that won't run it. Like, a really old version; this feature was added in Python 2.4, I believe.
answered Aug 3, 2012 at 14:43
kindall
185k36 gold badges291 silver badges321 bronze badges
Sign up to request clarification or add additional context in comments.
2 Comments
Martijn Pieters
Python 2.3 or earlier; python 2.4 gives a
NameError for any instead.mgilson
2.4 according to wikipedia ... The expression could be turned into a list-comp ... (that goes back to 2.0) (reference: en.wikipedia.org/wiki/List_comprehension#Python )
lang-py