Re: [Tutor] group txt files by month

2012-09-08 Thread questions anon
hmmm thank you, I obviously need to put some more thought in first. Thanks for the responses. On Sat, Sep 8, 2012 at 4:03 PM, Peter Otten <__pete...@web.de> wrote: > questions anon wrote: > > > Hello All, it has been a few months since I have used this and I have > only > > just realised I am hav

Re: [Tutor] group txt files by month

2012-09-08 Thread Mark Lawrence
On 08/09/2012 05:47, questions anon wrote: Hello All, it has been a few months since I have used this and I have only just realised I am having problems with leap years. each time I get to February of a leap year my program stops, therefore I have attributed it to my code not accounting for leap

Re: [Tutor] group txt files by month

2012-09-07 Thread Peter Otten
questions anon wrote: > Hello All, it has been a few months since I have used this and I have only > just realised I am having problems with leap years. each time I get to > February of a leap year my program stops, Does it throw an exception (if so, post the traceback) or does it just terminat

Re: [Tutor] group txt files by month

2012-09-07 Thread questions anon
Hello All, it has been a few months since I have used this and I have only just realised I am having problems with leap years. each time I get to February of a leap year my program stops, therefore I have attributed it to my code not accounting for leap years. Is there a simple way to fix my code (

Re: [Tutor] group txt files by month

2012-04-10 Thread questions anon
Thank you for this response it was a tremedous help. It still took me awhile to work it all out and thought I would post what worked for me. Thanks again GLOBTEMPLATE = r"e:/rainfall-{year}/r{year}{month:02}??.txt" def accumulate_month(year, month): files = glob.glob(GLOBTEMPLATE.format(year=

Re: [Tutor] group txt files by month

2012-04-05 Thread Peter Otten
questions anon wrote: > I have been able to write up what I want to do (using glob) but I am not > sure how to loop it or simplify it to make the script more efficient. > I am currently: > -grouping the same months in a year using glob > -opening the files in a group and combining the data using a

Re: [Tutor] group txt files by month

2012-04-04 Thread questions anon
I have been able to write up what I want to do (using glob) but I am not sure how to loop it or simplify it to make the script more efficient. I am currently: -grouping the same months in a year using glob -opening the files in a group and combining the data using a list -finding max, min etc for t

Re: [Tutor] group txt files by month

2012-04-04 Thread questions anon
thanks for responding. Glob and os.walk will work but I would need to type up a separate command for each month of each year and that doesn't seem very efficient. Is there a way to make it go through and group txt files with similar filenames e.g something like: if fname.endswith('.txt')and fname[0

Re: [Tutor] group txt files by month

2012-04-03 Thread Alan Gauld
On 03/04/12 04:59, questions anon wrote: I have a list of txt files that contain daily rainfall for many years. They are set out like: r20110101.txt r20110102.txt r20110103.txt and so on for each day for many years. MainFolder=r"E:/Rainfalldata/" outputFolder=r"E:/test/" for (path, dirs, files)

Re: [Tutor] group txt files by month

2012-04-02 Thread Asokan Pichai
On Tue, Apr 3, 2012 at 9:29 AM, questions anon wrote: > I think what I am trying to do is relatively easy but can't get my head > around how to do it. > I have a list of txt files that contain daily rainfall for many years. I > would like to produce a list that contains the year-month and the max,

[Tutor] group txt files by month

2012-04-02 Thread questions anon
I think what I am trying to do is relatively easy but can't get my head around how to do it. I have a list of txt files that contain daily rainfall for many years. I would like to produce a list that contains the year-month and the max, min and mean of rainfall for each month. My main question at t