Zip in python does not work properly with lists

Viewed 100

Here is what I tried:

>>> d
array([ 0.71428573,  0.69230771,  0.69999999], dtype=float32)
>>> f
[('name', 999), ('ddd', 33), ('mm', 112)]
>>> for n1,s1,normal in zip(d,f):
...     print(n1,s1,normal)
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: need more than 2 values to unpack

Then I tried this:

>>> for (name,confidence),normal in zip(d,f):
...     print(name,confidence,normal)
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'numpy.float32' object is not iterable

Where,

d = ['Jonathan Walsh','Patrick Walsh','John Welsh']
array = np.array(d)
from pyxdameraulevenshtein import damerau_levenshtein_distance_ndarray, normalized_damerau_levenshtein_distance_ndarray
 d = normalized_damerau_levenshtein_distance_ndarray('jwalsh', array)

Kindly, let me know what i need to do to print the values simultenously? I am using Python2.7.13 on Windows 10.

3 Answers
Related