-1
A
回答
3
[] - 是Python中的一個空列表,與調用list()例如[] ==列表() 要檢查該列表是空的則可以使用LEN(升)或:
listV = [] # an empty list
if listV:
# do something if list is not empty
else:
# do something if list is really empty
要詳細瞭解列表可以使用the following link
+2
所有空容器的計算結果都爲'False' – tauran
+1
@tbilisidavid,或者您可以使用len(emptyList)來確定列表是否爲空,以防萬一只是想檢查。 – OnesimusUnbound
0
列表是類似於C++的一些陣列區別。不同之處在於它們可以列出不同的類型甚至列表。檢查列表是空的
lists = []
len(lists)
lists[0]= "More of me"
len(lists)
更多檢查Python official教程及以上的文檔
相關問題
- 1. Python數組問題
- 2. socket編程問題 - python
- 3. Python編程一般問題
- 4. Python並行編程問題
- 5. Socket編程問題 - Python
- 6. Python編程縮進問題
- 7. C編程2D數組問題
- 8. 組選擇編程問題
- 9. python數組問題,求助!
- 10. Python編碼問題
- 11. 編碼問題-python
- 12. Python編碼問題
- 13. python編碼問題?
- 14. 數學編程問題
- 15. 兩個基本的Python編程問題
- 16. 問題編程
- 17. Python元組訪問問題?
- 18. Python數學sin/cos編碼問題
- 19. python numpy數組填充問題
- 20. Python的二維數組問題
- 21. 優化Python:大數組,內存問題
- 22. Python線程問題
- 23. Python線程問題
- 24. Python的編碼問題
- 25. python cgi.escape編碼問題
- 26. python編碼/解碼問題
- 27. 編譯Boost :: Python的問題
- 28. Python編碼問題(unicode)
- 29. 編碼問題:在Python
- 30. 編碼問題在Python
這不是Perl的。 perl版本是:@xcoords =(); –
對不起,我忘了添加數組符號,我該如何翻譯那個 – enginefree
你是指'[]'還是'()'?在Perl中,他們在那裏做了非常不同的事情。請複製並粘貼你想知道的實際代碼,否則你的問題變得毫無意義。 – ysth