[]是什么意思? 另外如何在python中将变量标识为空数组? 谢谢!
perl: xcoords = ()
我该如何翻译?
答案 0 :(得分:3)
[] - 是Python中的空列表,与调用list()相同,例如[] == list() 要检查列表是否为空,可以使用len(l)或:
listV = [] # an empty list
if listV:
# do something if list is not empty
else:
# do something if list is really empty
要阅读有关列表的更多信息,您可以使用the following link
答案 1 :(得分:0)
列表就像C ++数组一样有些不同。其中一个不同之处在于它们甚至可以列出不同类型的列表。检查列表是否为空
lists = []
len(lists)
lists[0]= "More of me"
len(lists)
更多检查Python official教程及以上文档