you should test the type of the sublist
def test_shape(list_): if type(list_[0]) is list: print('list_ is 2d') else: print('list_ is 1d')