语法错误python 3.4俄罗斯方块游戏

时间:2015-06-15 12:36:17

标签: python python-3.x python-3.4

def

此处(x,y)部分[BsonDiscriminator(RootClass = true)] [BsonKnownTypes(typeof(AccountEntry))] public class Entry { public ObjectId Id { get; set; } public string Register { get; set; } } 中存在语法错误...所以我该如何解决?

1 个答案:

答案 0 :(得分:1)

似乎是tuple parameter unpacking was removed in Python 3

所以这段代码

def foo(x, (y, z)):
    print(x, y, z)

foo(1, (2, 3))

适用于Python 2.7

>>> python2 test.py 
(1, 2, 3)

但在Python 3中失败

>>> python3 test.py 
  File "test.py", line 2
    def foo(x, (y, z)):
               ^
SyntaxError: invalid syntax

您还可以使用Python 2中的-3选项查看此内容:

>>> python2 -3 test.py 
test.py:2: SyntaxWarning: tuple parameter unpacking has been removed in 3.x
  def foo(x, (y, z)):
(1, 2, 3)