import openpyxl
wb1=openpyxl.load_workbook('tsp_result.xlsx')
wb2=openpyxl.load_workbook('144.xlsx')
sheet1=wb1.get_active_sheet()
sheet2=wb2.get_active_sheet()
for i in range(1,146):
te=0 #一定要先初始化爲一個int型
te=(sheet1.cell(row=i,column=1).value) #強制類型轉化 不初始化不能完成賦值!
sheet1.cell(row=i,column=2).value=sheet2.cell(row=te,column=2).value
wb1.save('tsp_result.xlsx') #保存才能更新值