returning results from function

Cameron Simpson cs at zip.com.au
Wed Nov 17 21:58:49 EST 2010


On 11Nov2010 15:29, Chris Rebert <crebert at ucsd.edu> wrote:
| > On Nov 11, 2010, at 1:54 PM, Chris Rebert wrote:
| >> On Thu, Nov 11, 2010 at 1:16 PM, Neil Berg <nberg at atmos.ucla.edu> wrote:
| >> time_y = ncfile.variables['time_y'][:] # (time,int) [yrs]
| >> time_m = ncfile.variables['time_m'][:] # (time,int) [mnths]
| >> time_d = ncfile.variables['time_d'][:] # (time,int) [days]
| >> time_h = ncfile.variables['time_h'][:]    # (time,float) [hrs]
| >> ntim =len(time_h)
| >> for tim_idx in range(0,ntim):
| >>        local_date = utc_to_local(time_y[tim_idx],time_m[tim_idx],time_d[tim_idx],int(time_h[tim_idx]))
| >>        ***Here is where I'd like to see the returned values so I can create new arrays that store them *****
| 
| Add:
|     print(local_date)
| Or if you want to be fancy:
|     print("%.4d-%.2d-%.2d  %.2d" % local_date)

It's worth noting that if you know the number of return arguments you
can do this:

  locyr, locmm, locdd, lochh = itc_to_local(.......)

and then easily use the individual values.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Admit Nothing.  Blame Everyone.  Be Bitter.
        - Matt Hopkins, DoD #1197, <matt at crawfish.math.tulane.edu>



More information about the Python-list mailing list