import heapq heap [heapq heappush(heap( "rest")heapq heappush(heap( "work")heapq heappush(heap( "study")if we already have listwe can turn it into heap with heapq heapify(alist)this will do any necessary reordering in-place the smallest item can be removed from the heap using heapq heappop(heapfor in heapq merge([ ][ ][ ])print(xend="prints the heapq merge(function takes any number of sorted iterables as arguments and returns an iterator that iterates over all the items from all the iterables in order file formatsencodingsand data persistence character encodings |the standard library has extensive support for variety of standard file formats and encodings the base module has functions for reading and writing using the base base and base encodings specified in rfc the quopri module has functions for reading and writing "quoted-printableformat this format is defined in rfc and is used for mime (multipurpose internet mail extensionsdata the uu module has functions for reading and writing uuencoded data rfc defines the external data representation standard and module xdrlib provides functions for reading and writing data in this format modules are also provided for reading and writing archive files in the most popular formats the bz module can handle bz filesthe gzip module handles gz filesthe tarfile module handles tartar gz (also tgz)and tar bz filesand the zipfile module handles zip files we will see an example of using the tarfile module in this subsectionand later on there is small example that uses the gzip modulewe will also see the gzip module in action again in support is also provided for handling some audio formatswith the aifc module for aiff (audio interchange file formatand the wave module for (uncompressedwav files some forms of audio data can be manipulated using the audioop moduleand the sndhdr module provides couple of functions for determining what kind of sound data is stored in file and some of its propertiessuch as the sampling rate rfc (request for commentsdocuments are used to specify various internet technologies each one has unique identification number and many of them have become officially adopted standards