function with list inputs in python -
i trying create function ex:
rotateelement (doc, lmnt_id, axis, angle)
lmnt_id
, axis
, angle
inputs come in form of list. ex:
axis = [line1, line2, line3] angle = [20, 25, 30] lmnt_id = [1, 2, 3] doc constant value
how can call function iterates through inputs. want use line1, 20 , 1 when runs first time line2, 25 , 2 when runs second time , on. tried runs once:
for in lmnt_ids: lmnt_id = j in axises: axis = j result.append(elementtransformutils.rotateelement (doc, lmnt_id, axis, angle))
thank you!
it looks want:
for axis_, angle_, lmnt_id_ in zip(axis, angle, lmnt_id): result.append(elementtransformutils.rotateelement(doc, lmnt_id_, axis_, angle_))
zip
match 3 lists , assign n
th value each loop variables in turn
Comments
Post a Comment