2017-02-23 34 views
2

Variable with several arrays in it如何從具有多個數組的變量移動空數組?

我得到這個使用這個代碼後:

ARRAY1 = numpy.empty((0,4),INT)

一個,B,C,d的東西:

ARRAY1 = numpy.vstack([數組1,[A,b,C,D]])

我不知道爲什麼我得到空陣列。有沒有辦法刪除它們?

+0

[see here](http://stackoverflow.com/questions/4842956/python-how-to-remove-empty-lists-from-a-list) – mkHun

+1

[Python:可能的重複:如何從一個列出?](http://stackoverflow.com/questions/4842956/python-how-to-remove-empty-lists-from-a-list) –

回答

0
L = [[], [1, 4]] 
C = filter(lambda x: x!=[], L) 
print(C) 

OUT:

[[4,2]] 

ALTERNATIVE:

C = filter(lambda x: len(x) > 0, L) 
print(C) 

OUT:

[[4,2]] 
相關問題