日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python中对比数组长度_在Python中检索数组长度的首选方法

發布時間:2025/3/11 python 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python中对比数组长度_在Python中检索数组长度的首选方法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

python中對比數組長度

The __len__() is a method on container types. However, python also provides another option of retrieving the length of an array, using the method len().

__len __()是關于容器類型的方法。 但是,python還使用len()方法提供了另一個檢索數組長度的選項。

The len(abc) usually ends up calling abc.__len__().

len(abc)通常最終會調用abc .__ len __() 。

Example usage of len() method is as follows,

len()方法的示例用法如下,

# array declaration test_arr = [1,2,3]# length print(len(test_arr)) print(test_arr.__len__())

Output

輸出量

3 3

The len() method works on a tuple, string (which are array of characters) in similar way.

len()方法以類似的方式處理元組,字符串(字符數組)。

test_tuple = (1,2,3)# length print(len(test_tuple))# string test_str = 'include-help'# length print(len(test_str))

Output

輸出量

3 12

翻譯自: https://www.includehelp.com/python/preferred-way-to-retrieve-the-length-of-an-array.aspx

python中對比數組長度

總結

以上是生活随笔為你收集整理的python中对比数组长度_在Python中检索数组长度的首选方法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。