ValueError: max() arg is an empty sequence

前端 未结 5 2383
礼貌的吻别
礼貌的吻别 2021-01-03 18:37

I\'ve created a GUI using wxFormBuilder that should allow a user to enter the names of \"visitors to a business\" into a list and then click one of two buttons to return the

5条回答
  •  礼貌的吻别
    2021-01-03 18:49

    in one line,

    v = max(v) if v else None

    >>> v = []
    >>> max(v)
    Traceback (most recent call last):
      File "", line 1, in 
    ValueError: max() arg is an empty sequence
    >>> v = max(v) if v else None
    >>> v
    >>> 
    

提交回复
热议问题