python - Longest string in numpy object_ array -


I am using a numpy object_ array to store the variable length string, e.g.

  a = Np.array (['hello', 'world', '!'], Dtype = np.object_)  

An easy way to find the length of the long string without looping array on all elements?

maximum (A, key = lane) gives len (max (a, key = len)) gives you its length without you need a clear loop code, but surely max internally Will do its own looping because it probably can not identify the "longest string" in any other way.


Comments

Popular posts from this blog

MySql variables and php -

c# - How can I find out if there are windows above a control? -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -