Few coding suggestions

Denis McMahon denismfmcmahon at gmail.com
Sun Jan 11 12:37:26 EST 2015


On Sun, 11 Jan 2015 17:14:35 +0530, Ganesh Pal wrote:

> (a)  How do I modify the output to have an another column with a
> difference of 5 mins

I'm not sure I understand the problem you're trying to solve, and it 
seems to me that you are presenting your problem in terms of your partial 
solution.

Try stating the actual problem.

Some hints, based on my best guess of what you're actually trying to do.

If you want a program to execute every n minutes, the easiest way to do 
this is normally to use the cron scheduler to start your program every n 
minutes.

If you want to append the output of a program to an existing file, open 
the file in append mode.

You normally add lines to a file, not columns.

You my want to investigate various ways of serialising data inside a 
file, eg csv, json etc. Also things like date and time formats if this is 
some sort of log file.

It would however be much easier to help you with your problem if you 
stated the problem you're trying to solve, eg "I wish to create a 
snapshot of process memory and cpu use every 5 minutes and send it to 
another server."

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list