# This sample program calculates total food production # and writes the result to an external file # using savetxt command. # The external file is : foodprod.dat import numpy as np fdat = np.loadtxt('food.dat', skiprows=5, usecols=(1,2,3,4,5,6,7,8,9)) totalprod = np.sum(fdat, axis=0) print( totalprod ) np.savetxt('foodprod.dat', totalprod, fmt='%7.2f')