代码中的错误是
psspy.three_wnd_winding_data_3(from_,to,last_bus,r"""1""",1,[_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f, max_value, min_value,_f,_f,_f])
TypeError: an integer is required
我以为我已经将字符串转换为整数。我很困惑。因为其他变量, year_link
,tla_2
不需要我使用min_value
and 。变量被传输到函数数组中。错误说,它正在读取. 有谁知道如何解决这个问题,可以向我解释为什么我必须为 Excel 表的最后一列转换字符串。电子表格max_value
isinstance
isdigit
psspy
last_bus
for row in data:
year_link, from_,to,digit,name2,tla_2,min_value,max_value,last_bus = row[7:16]
if isinstance(last_bus, str) and year_link==year and tla_2==location and last_bus.isdigit() is True:
min_value=float(min_value)
max_value=float(max_value)
last_bus=int(last_bus)
output = 'From Bus #: {}\tTo Bus #: {}\tLast Bus #: {}\t Area Station: {}\t VMIN: {} pu\tVMAX: {} pu\t'
print(output.format(from_, to,last_bus,name2, min_value, max_value))
print("\n")
psspy.three_wnd_winding_data_3(from_,to, last_bus,r"""1""",1,[_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f, max_value, min_value,_f,_f,_f])
else:
exit