def printhdr(file):
 hdr = gethdr(open(file, 'r'))
 (data_size, encoding, sample_rate, channels, info) = hdr
 while (info[(-1):] == '\x00'):
  info = info[:(-1)]
 print 'File name:  ', file
 print 'Data size:  ', data_size
 print 'Encoding:   ', encoding
 print 'Sample rate:', sample_rate
 print 'Channels:   ', channels
 print 'Info:       ', repr(info)

def printhdr ( file ) : hdr = gethdr ( open ( file , 'r' ) ) ( data_size , encoding , sample_rate , channels , info ) = hdr while ( info [ ( - 1 ) : ] == '\x00' ) : info = info [ : ( - 1 ) ] print 'File name:  ' , file print 'Data size:  ' , data_size print 'Encoding:   ' , encoding print 'Sample rate:' , sample_rate print 'Channels:   ' , channels print 'Info:       ' , repr ( info )
read and print the sound header of a named file .