Syntaxerror Trying To Execute Python 3 Code With Python 2.7
I run the python 3 code which from others code as following in the python 2.7 environment, there is error as following, please give me some hints how to solve it, thanks! If you wa
Solution 1:
Extended Iterable Upacking is only available in Python 3.0 and later.
Refer to this question for workarounds.
Solution 2:
The script is using something called "Extended Iterable Unpacking" which was added to Python 3.0. The feature is described in PEP 3132.
To do the same thing in Python 2, replace the problem line:
filename, score, *rect = line.strip().split()
with these two lines:
seq = line.strip().split()
filename, score, rect = seq[0], seq[1], seq[2:]
OR these two:
seq = line.strip().split()
(filename, score), rect = seq[:2], seq[2:]
Post a Comment for "Syntaxerror Trying To Execute Python 3 Code With Python 2.7"