mardi 26 juin 2018

Python: ValueError with zip, tuple, enumerate, and if condition

The second line in the following code gives ValueError: not enough values to unpack (expected 2, got 0), however there is no error if I remove if condition from it.

xIn,yIn=zip(*[(xSrcList[i]-2,ySrcList[i]*0.1) for i in range(len(xSrcList))])

xOut,xOuti=zip(*[(x,i) for i,(x,y) in enumerate(zip(xIn,yIn)) if x<5 and y>3])

Please help me to understand this error and fix this line of code. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire