1
配列要素の最大長をチェックしたいと思います。私は単純なコードで行うことができますが、これをPython 3で実装するもう1つのスマートな方法はありますか?Pythonの配列要素の最大長を確認してください
a = [[1,2], [1], [2,2,3,3], [2,2]]
max_len = 0
for d in a:
max_len = len(d) if len(d) > max_len else max_len
print(max_len)
'MAX(LEN(x)の中のxについて)'、あるいは'max(map(len、a))' – Julien
[Pythonの最も効率的なリストの中で最も長い文字列を選択する方法は?](http://stackoverflow.com/questions/873327/pythons-most-efficient-way -to-choose-longest-string-in-list) –