Is arr.__len__() the preferred way to get the length of an array in Python?

前端 未结 8 1012
悲哀的现实
悲哀的现实 2020-12-04 05:18

In Python, is the following the only way to get the number of elements?

arr.__len__()

If so, why the strange syntax?

8条回答
  •  -上瘾入骨i
    2020-12-04 05:31

    len(list_name) function takes list as a parameter and it calls list's __len__() function.

提交回复
热议问题