如果施工不';不能在Python2.4中工作,但可以在Python2.7.13中工作 def make_single(op、size、end、sign): 名称=“\u%s%s%s%”(操作、大小、结束、符号) fmt=尺寸[尺寸] end='>'if end=='b'else''if end=='b'else'

如果施工不';不能在Python2.4中工作,但可以在Python2.7.13中工作 def make_single(op、size、end、sign): 名称=“\u%s%s%s%”(操作、大小、结束、符号) fmt=尺寸[尺寸] end='>'if end=='b'else''if end=='b'else',python,Python,Python 2.4(在2.5中添加)上根本不支持它。请参阅。事实上,该构造在Python2.4中是无效的,因为它是在Python2.5中引入的。但是,您为什么要使用2004年发布的2.4版本,自2008年以来一直不受支持?请正确格式化您的代码 def make_single(op,size,end,sign): name = '_%s%s%s%s' % (op, size, end, sign) fmt = sizes[size] end = '>' if end == 'b' els

Python 2.4(在2.5中添加)上根本不支持它。请参阅。

事实上,该构造在Python2.4中是无效的,因为它是在Python2.5中引入的。但是,您为什么要使用2004年发布的2.4版本,自2008年以来一直不受支持?

请正确格式化您的代码
def make_single(op,size,end,sign):
name = '_%s%s%s%s' % (op, size, end, sign)
fmt  = sizes[size]
end = '>' if end == 'b' else '<'
    sh-3.2$ python test.py
      File "test.py", line 195
        end = '>' if end == 'b' else '<'
                   ^
    SyntaxError: invalid syntax