closing image automatically in for loop , python
fpm at u.washington.edu
Wed Apr 12 11:28:13 EDT 2017
On Wed, 12 Apr 2017 04:18:45 -0700, Masoud Afshari wrote:
> filename ="Ex_resample" +'_sdf_'+ str(n)+'.dat'
> with open(filename, 'rb') as f: #read binary file data = np.fromfile(f,
> dtype='float64', count=nx*ny) #float64 for Double precision float numbers
> Ex = np.reshape(data, [ny, nx], order='F')
> #print Ex.max()
Your use of the 'with open(...) as f :' should automatically close access to
filename once beyond that section. In your posting, the commented-out sections
and garbled spacing would prevent anything useful from happening.
Does that accurately reflect the code you're trying to run?
More information about the Python-list