rank vote view answer url
12 2862 1856471 30 url

检查列表是否为空的最好方法

例如,传递下面:

a = []

我怎么检查a是空值?


if not a:
  print "List is empty"

用隐藏的空列表的布尔值才是最Pythonic的方法.

Copyright © taizilongxu 2018 all right reserved,powered by Gitbook该文件修订时间: 2018-10-17 17:33:54

results matching ""

    No results matching ""