I am having trouble with a piece of my code. I want to store an output statement to a variable. I want to put it outside the for loop so it outputs the statement at the end of my code rather than inside the loop. Is this possible. This is what I tried but I only get one output where multiple statements should be outputting.
outputs=[]
if Year in mydict and data_location in mydict[Year]:
busses_in_year = mydict[Year]
#print("Here are all the busses at that location for that year and the new LOAD TOTAL: ")
#print("\n")
#Busnum, busname,scaled_power read from excel sheet matching year and location
for busnum,busname,scaled_power in busses_in_year[data_location]:
scaled_power= float(scaled_power)
busnum = int(busnum)
output='Bus #: {}\t Area Station: {}\t New Load Total: {} MW\t'
formatted = output.format(busnum, busname, scaled_power)
outputs.append(formatted)
psspy.bsys(1,0,[0.0,0.0],0,[],1,[busnum],0,[],0,[])
psspy.scal_2(1,0,1,[0,0,0,0,0],[0.0,0.0,0.0,0.0,0.0,0.0,0.0])
psspy.scal_2(0,1,2,[0,1,0,1,0],[scaled_power,0.0,0,-.0,0.0,-.0,0])
psspy.fdns([0,0,1,1,0,0,0,0])
else:
exit
print(formatted)
formattedinstead ofoutputs?outputsis the list of all your formatted output strings.