Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~1K People Reached
Favorite Forums
Member Avatar for chebude

I am trying to catch error on file input/output. The try functions works fine but as it pass to the next line my code breaks. How can I exit gracefully when the 'infile' doesnt exist? [CODE] try: infile = open ('Book1.txt', "r") except IOError: print "input file %s is missing" …

Member Avatar for chebude
0
261
Member Avatar for chebude

I was able to print out daily values and aggregate the final annual result but I am lost and dont know where to start on how to sum the daily values to monthly and print it out. I need your help badely. Here is part of the code [CODE] import …

Member Avatar for woooee
0
144
Member Avatar for chebude

I am stuck with large text files which I have to merge and further work with my model. I tried to follow the previous thread in text merging [url]http://www.daniweb.com/forums/thread38625.html[/url] Here is the script which I used: [CODE= python] one = open("one.txt",'r') two = open("two.txt",'r') ofh = open("out.txt",'w') # read in …

Member Avatar for chebude
0
129
Member Avatar for chebude

I want to read a file and convert the columns to rows. A 1 2 3 4 5 6 7 8 9 10 B 11 12 13 14 15 16 17 18 19 20 C 21 22 23 24 25 26 27 28 29 30 want them to be like …

Member Avatar for BearofNH
0
96
Member Avatar for chebude

I have too collect a daily rainfall data from a certain model output. The model ouput gives out each stations daily data separately which I have to collect together and further analyse. [I have tried the following, it works but my data - thousands of pcp_#.txt which makes the process …

Member Avatar for chebude
0
163
Member Avatar for chebude

I was trying to write the output of a loop on a file. The problem is the writing repeats for each loop. [ICODE]prev_line = "" while line: Total = 0 fields = line.split() N = len(fields) name = fields[0] #sum each 5 fields over the raw: for step in range …

Member Avatar for chebude
0
84
Member Avatar for chebude

Here I am again with new problem. I want to do some calculation on each field row after row. The for loop which I tried is not giving me what I expected [ICODE]#sum each 5 fields over the raw: for step in range (6, N, 5): for i in range …

Member Avatar for chebude
0
95
Member Avatar for chebude

I am a bigginer in python and even programming. I want to use python in my thesis for reading and writing large size data. I have a little sample of code which access which runs over the lines and reads each element on a line. [ICODE]def get_site_only(pat): newpat = "" …

Member Avatar for jlm699
0
108