First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

spending time for writng

asked Aug 9 '17

Amir90 gravatar image

Hello,

I want to write a load model in savnw.dyr file, but when I open the file, I couldn't see anything, actually it's taking too late to write on it, I don't know what't the problem. can you help me? Thanks.

I My code is as follow:

import time
start = time.clock() 
f= open("savnw.dyr","a") 
LM=20 
SM=50
DL=6
CP=7
Rem=10
f.write('\t\t\t%0.2f\t%0.2f\t%0.2f\t%0.2f\t%0.2f'%(LM,SM,DL,CP,Rem))
end = time.clock()
print end

1 answer

Sort by » oldest newest most voted
0

answered Aug 10 '17

jconto gravatar image

It is a good practice to use the close() method to close a file. After the f.write line add:

f.close()

link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Aug 9 '17

Seen: 178 times

Last updated: Aug 09 '17