嗨,我正在嘗試從 matplotlib.pyplot.ginput 獲取一組點。我的想法是將點保存在串列中,而actuaPoint!=lastPoint
有沒有辦法做到這一點:
lastPoint = None
pointList = []
actualPoint = plt.ginput(1)
while (actualPoint=plt.input()) != lastPoint:
pointList.append(actualPoint)
lastPoint= actualPoint
? 繼續我想知道是否有辦法在 while 陳述句中進行變數賦值
uj5u.com熱心網友回復:
您需要使用賦值運算式,使用:=運算子。
point, = pointList = [plt.ginput(1)]
while (next_point := plt.input()) != point:
pointList.append(next_point)
point = next_point
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/340431.html
